linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT] i2c: brcmstb: properly check NACK condition
@ 2020-04-26  8:12 Wolfram Sang
  2020-04-27 18:15 ` Kamal Dasu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wolfram Sang @ 2020-04-26  8:12 UTC (permalink / raw)
  To: linux-i2c
  Cc: Stefan Wahren, Wolfram Sang, Kamal Dasu, Florian Fainelli,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-kernel

From: Wolfram Sang <wsa@the-dreams.de>

cppcheck rightfully complains about:

drivers/i2c/busses/i2c-brcmstb.c:319:7: warning: Condition 'CMD_RD' is always true [knownConditionTrueFalse]
drivers/i2c/busses/i2c-brcmstb.c:319:17: warning: Condition 'CMD_WR' is always false [knownConditionTrueFalse]
 if ((CMD_RD || CMD_WR) &&

Compare the values to the 'cmd' variable.

Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver")
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
---

Not tested on HW.

 drivers/i2c/busses/i2c-brcmstb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
index d4e0a0f6732a..ba766d24219e 100644
--- a/drivers/i2c/busses/i2c-brcmstb.c
+++ b/drivers/i2c/busses/i2c-brcmstb.c
@@ -316,7 +316,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev,
 		goto cmd_out;
 	}
 
-	if ((CMD_RD || CMD_WR) &&
+	if ((cmd == CMD_RD || cmd == CMD_WR) &&
 	    bsc_readl(dev, iic_enable) & BSC_IIC_EN_NOACK_MASK) {
 		rc = -EREMOTEIO;
 		dev_dbg(dev->device, "controller received NOACK intr for %s\n",
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFT] i2c: brcmstb: properly check NACK condition
  2020-04-26  8:12 [PATCH RFT] i2c: brcmstb: properly check NACK condition Wolfram Sang
@ 2020-04-27 18:15 ` Kamal Dasu
  2020-04-27 18:28 ` Florian Fainelli
  2020-04-28 22:09 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Kamal Dasu @ 2020-04-27 18:15 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Stefan Wahren, Wolfram Sang, Florian Fainelli,
	bcm-kernel-feedback-list, linux-arm-kernel,
	Linux Kernel Mailing List

On Sun, Apr 26, 2020 at 4:12 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> From: Wolfram Sang <wsa@the-dreams.de>
>
> cppcheck rightfully complains about:
>
> drivers/i2c/busses/i2c-brcmstb.c:319:7: warning: Condition 'CMD_RD' is always true [knownConditionTrueFalse]
> drivers/i2c/busses/i2c-brcmstb.c:319:17: warning: Condition 'CMD_WR' is always false [knownConditionTrueFalse]
>  if ((CMD_RD || CMD_WR) &&
>
> Compare the values to the 'cmd' variable.
>
> Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver")
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

Reviewed-by: Kamal Dasu <kdasu.kdev@gmail.com>

 ---
>
> Not tested on HW.
>
>  drivers/i2c/busses/i2c-brcmstb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
> index d4e0a0f6732a..ba766d24219e 100644
> --- a/drivers/i2c/busses/i2c-brcmstb.c
> +++ b/drivers/i2c/busses/i2c-brcmstb.c
> @@ -316,7 +316,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev,
>                 goto cmd_out;
>         }
>
> -       if ((CMD_RD || CMD_WR) &&
> +       if ((cmd == CMD_RD || cmd == CMD_WR) &&
>             bsc_readl(dev, iic_enable) & BSC_IIC_EN_NOACK_MASK) {
>                 rc = -EREMOTEIO;
>                 dev_dbg(dev->device, "controller received NOACK intr for %s\n",
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFT] i2c: brcmstb: properly check NACK condition
  2020-04-26  8:12 [PATCH RFT] i2c: brcmstb: properly check NACK condition Wolfram Sang
  2020-04-27 18:15 ` Kamal Dasu
@ 2020-04-27 18:28 ` Florian Fainelli
  2020-04-28 22:09 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2020-04-27 18:28 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Stefan Wahren, Wolfram Sang, Kamal Dasu,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-kernel



On 4/26/2020 1:12 AM, Wolfram Sang wrote:
> From: Wolfram Sang <wsa@the-dreams.de>
> 
> cppcheck rightfully complains about:
> 
> drivers/i2c/busses/i2c-brcmstb.c:319:7: warning: Condition 'CMD_RD' is always true [knownConditionTrueFalse]
> drivers/i2c/busses/i2c-brcmstb.c:319:17: warning: Condition 'CMD_WR' is always false [knownConditionTrueFalse]
>  if ((CMD_RD || CMD_WR) &&
> 
> Compare the values to the 'cmd' variable.
> 
> Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver")
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFT] i2c: brcmstb: properly check NACK condition
  2020-04-26  8:12 [PATCH RFT] i2c: brcmstb: properly check NACK condition Wolfram Sang
  2020-04-27 18:15 ` Kamal Dasu
  2020-04-27 18:28 ` Florian Fainelli
@ 2020-04-28 22:09 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2020-04-28 22:09 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Stefan Wahren, Kamal Dasu, Florian Fainelli,
	bcm-kernel-feedback-list, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

On Sun, Apr 26, 2020 at 10:12:10AM +0200, Wolfram Sang wrote:
> From: Wolfram Sang <wsa@the-dreams.de>
> 
> cppcheck rightfully complains about:
> 
> drivers/i2c/busses/i2c-brcmstb.c:319:7: warning: Condition 'CMD_RD' is always true [knownConditionTrueFalse]
> drivers/i2c/busses/i2c-brcmstb.c:319:17: warning: Condition 'CMD_WR' is always false [knownConditionTrueFalse]
>  if ((CMD_RD || CMD_WR) &&
> 
> Compare the values to the 'cmd' variable.
> 
> Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver")
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-28 22:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26  8:12 [PATCH RFT] i2c: brcmstb: properly check NACK condition Wolfram Sang
2020-04-27 18:15 ` Kamal Dasu
2020-04-27 18:28 ` Florian Fainelli
2020-04-28 22:09 ` Wolfram Sang

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).