linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Yueyao Zhu <yueyao.zhu@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 3/7] staging: typec: fusb302: Fix chip->vbus_present init value
Date: Tue,  9 May 2017 09:04:55 -0700	[thread overview]
Message-ID: <1494345899-14283-3-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1494345899-14283-1-git-send-email-linux@roeck-us.net>

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

  parent reply	other threads:[~2017-05-09 16:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09 16:04 [PATCH 1/7] staging: typec: tcpci: declare private structure as static Guenter Roeck
2017-05-09 16:04 ` [PATCH 2/7] staging: typec: fusb302: Fix module autoload Guenter Roeck
2017-05-09 16:04 ` Guenter Roeck [this message]
2017-05-09 16:04 ` [PATCH 4/7] staging: typec: tcpm: Drop duplicate PD messages Guenter Roeck
2017-05-09 16:04 ` [PATCH 5/7] staging: typec: tcpm: Set correct flags in PD request messages Guenter Roeck
2017-05-09 16:04 ` [PATCH 6/7] staging: typec: tcpm: Respond to Discover Identity commands Guenter Roeck
2017-05-09 16:04 ` [PATCH 7/7] staging: typec: tcpm: Fix Port Power Role field in PS_RDY messages Guenter Roeck
2017-05-09 17:46 ` [PATCH 1/7] staging: typec: tcpci: declare private structure as static Greg Kroah-Hartman
2017-05-09 21:13   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1494345899-14283-3-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yueyao.zhu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).