Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638249

[PATCH 3/7] staging: typec: fusb302: Fix chip->vbus_present init value

From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject [PATCH 3/7] staging: typec: fusb302: Fix chip->vbus_present init value
Date 2017-05-09 18:10 +0200
Message-ID <tFfS2-41K-23@gated-at.bofh.it> (permalink)
References <tFfS1-41K-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Yueyao Zhu <yueyao.zhu@gmail.com>

FUSB_REG_STATUS0 & FUSB_REG_STATUS0_VBUSOK = 0x40 & 0x80 is always
zero. Fix the code to what it is intended to be: check the VBUSOK
bit of the value read from address FUSB_REG_STATUS0.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Yueyao Zhu <yueyao.zhu@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/staging/typec/fusb302/fusb302.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c
index aa460f93a293..d8b50b49bb2d 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -489,7 +489,7 @@ static int tcpm_init(struct tcpc_dev *dev)
 	ret = fusb302_i2c_read(chip, FUSB_REG_STATUS0, &data);
 	if (ret < 0)
 		return ret;
-	chip->vbus_present = !!(FUSB_REG_STATUS0 & FUSB_REG_STATUS0_VBUSOK);
+	chip->vbus_present = !!(data & FUSB_REG_STATUS0_VBUSOK);
 	ret = fusb302_i2c_read(chip, FUSB_REG_DEVICE_ID, &data);
 	if (ret < 0)
 		return ret;
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/7] staging: typec: tcpci: declare private structure as static Guenter Roeck <linux@roeck-us.net> - 2017-05-09 18:10 +0200
  [PATCH 2/7] staging: typec: fusb302: Fix module autoload Guenter Roeck <linux@roeck-us.net> - 2017-05-09 18:10 +0200
  [PATCH 4/7] staging: typec: tcpm: Drop duplicate PD messages Guenter Roeck <linux@roeck-us.net> - 2017-05-09 18:10 +0200
  [PATCH 3/7] staging: typec: fusb302: Fix chip->vbus_present init value Guenter Roeck <linux@roeck-us.net> - 2017-05-09 18:10 +0200
  [PATCH 5/7] staging: typec: tcpm: Set correct flags in PD request messages Guenter Roeck <linux@roeck-us.net> - 2017-05-09 18:10 +0200
  Re: [PATCH 1/7] staging: typec: tcpci: declare private structure as  static Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-09 19:50 +0200
    Re: [PATCH 1/7] staging: typec: tcpci: declare private structure as  static Guenter Roeck <linux@roeck-us.net> - 2017-05-09 23:20 +0200

csiph-web