* [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition
@ 2021-02-25 16:11 Maxime Ripard
2021-02-25 16:16 ` Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Maxime Ripard @ 2021-02-25 16:11 UTC (permalink / raw)
To: Kamal Dasu, Florian Fainelli, Wolfram Sang
Cc: bcm-kernel-feedback-list, linux-i2c, Maxime Ripard, Dave Stevenson
The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD ||
CMD_WR) which always evaluates to true, while the obvious fix is to test
whether the cmd variable passed as parameter holds one of these two
values.
Reported-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
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.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition
2021-02-25 16:11 [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition Maxime Ripard
@ 2021-02-25 16:16 ` Florian Fainelli
2021-02-25 18:31 ` Wolfram Sang
2021-02-26 10:24 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2021-02-25 16:16 UTC (permalink / raw)
To: Maxime Ripard, Kamal Dasu, Florian Fainelli, Wolfram Sang
Cc: bcm-kernel-feedback-list, linux-i2c, Dave Stevenson
On 2/25/2021 8:11 AM, Maxime Ripard wrote:
> The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD ||
> CMD_WR) which always evaluates to true, while the obvious fix is to test
> whether the cmd variable passed as parameter holds one of these two
> values.
>
> Reported-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c
controller driver")
Thanks!
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition
2021-02-25 16:11 [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition Maxime Ripard
2021-02-25 16:16 ` Florian Fainelli
@ 2021-02-25 18:31 ` Wolfram Sang
2021-02-26 10:24 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-02-25 18:31 UTC (permalink / raw)
To: Maxime Ripard
Cc: Kamal Dasu, Florian Fainelli, bcm-kernel-feedback-list,
linux-i2c, Dave Stevenson
[-- Attachment #1: Type: text/plain, Size: 704 bytes --]
On Thu, Feb 25, 2021 at 05:11:01PM +0100, Maxime Ripard wrote:
> The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD ||
> CMD_WR) which always evaluates to true, while the obvious fix is to test
> whether the cmd variable passed as parameter holds one of these two
> values.
>
> Reported-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
I got a feeling of deja vu...
... and, in deed, I already fixed this, too, one year ago:
http://patchwork.ozlabs.org/project/linux-i2c/patch/20200426081211.10876-1-wsa+renesas@sang-engineering.com/
Dunno why it never appeared in a pull request :(
I'll pick this one, now!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition
2021-02-25 16:11 [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition Maxime Ripard
2021-02-25 16:16 ` Florian Fainelli
2021-02-25 18:31 ` Wolfram Sang
@ 2021-02-26 10:24 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-02-26 10:24 UTC (permalink / raw)
To: Maxime Ripard
Cc: Kamal Dasu, Florian Fainelli, bcm-kernel-feedback-list,
linux-i2c, Dave Stevenson
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
On Thu, Feb 25, 2021 at 05:11:01PM +0100, Maxime Ripard wrote:
> The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD ||
> CMD_WR) which always evaluates to true, while the obvious fix is to test
> whether the cmd variable passed as parameter holds one of these two
> values.
>
> Reported-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
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:[~2021-02-26 10:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-25 16:11 [PATCH] i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition Maxime Ripard
2021-02-25 16:16 ` Florian Fainelli
2021-02-25 18:31 ` Wolfram Sang
2021-02-26 10:24 ` 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).