[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC=U0a2p+vGfzTJOBaAuFUWh1azJC49cundYAOG0C5JjMgQtzA@mail.gmail.com>
Date: Mon, 27 Apr 2020 14:15:54 -0400
From: Kamal Dasu <kdasu.kdev@...il.com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>
Cc: linux-i2c@...r.kernel.org, Stefan Wahren <stefan.wahren@...e.com>,
Wolfram Sang <wsa@...-dreams.de>,
Florian Fainelli <f.fainelli@...il.com>,
bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
linux-arm-kernel@...ts.infradead.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFT] i2c: brcmstb: properly check NACK condition
On Sun, Apr 26, 2020 at 4:12 AM Wolfram Sang
<wsa+renesas@...g-engineering.com> wrote:
>
> From: Wolfram Sang <wsa@...-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@...-dreams.de>
Reviewed-by: Kamal Dasu <kdasu.kdev@...il.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
>
Powered by blists - more mailing lists