2020-04-26 08:14:34

by Wolfram Sang

[permalink] [raw]
Subject: [PATCH RFT] i2c: brcmstb: properly check NACK condition

From: Wolfram Sang <[email protected]>

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 <[email protected]>
---

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


2020-04-27 18:19:20

by Kamal Dasu

[permalink] [raw]
Subject: Re: [PATCH RFT] i2c: brcmstb: properly check NACK condition

On Sun, Apr 26, 2020 at 4:12 AM Wolfram Sang
<[email protected]> wrote:
>
> From: Wolfram Sang <[email protected]>
>
> 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 <[email protected]>

Reviewed-by: Kamal Dasu <[email protected]>

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

2020-04-27 18:31:02

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH RFT] i2c: brcmstb: properly check NACK condition



On 4/26/2020 1:12 AM, Wolfram Sang wrote:
> From: Wolfram Sang <[email protected]>
>
> 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 <[email protected]>

Acked-by: Florian Fainelli <[email protected]>
--
Florian

2020-04-28 22:13:37

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH RFT] i2c: brcmstb: properly check NACK condition

On Sun, Apr 26, 2020 at 10:12:10AM +0200, Wolfram Sang wrote:
> From: Wolfram Sang <[email protected]>
>
> 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 <[email protected]>

Applied to for-current, thanks!


Attachments:
(No filename) (637.00 B)
signature.asc (849.00 B)
Download all attachments