* [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call
@ 2024-10-02 16:53 Colin Ian King
2024-10-03 6:05 ` Sakari Ailus
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Colin Ian King @ 2024-10-02 16:53 UTC (permalink / raw)
To: Tomi Valkeinen, Mauro Carvalho Chehab, Andy Shevchenko,
Sakari Ailus, linux-media
Cc: kernel-janitors, linux-kernel
The function ub960_rxport_read is being called and afterwards ret is
being checked for any failures, however ret is not being assigned to
the return of the function call. Fix this by assigning ret to the
return of the call which appears to be missing.
Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/media/i2c/ds90ub960.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
index ffe5f25f8647..58424d8f72af 100644
--- a/drivers/media/i2c/ds90ub960.c
+++ b/drivers/media/i2c/ds90ub960.c
@@ -1286,7 +1286,7 @@ static int ub960_rxport_get_strobe_pos(struct ub960_data *priv,
clk_delay += v & UB960_IR_RX_ANA_STROBE_SET_CLK_DELAY_MASK;
- ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v);
+ ret = ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v);
if (ret)
return ret;
--
2.39.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call 2024-10-02 16:53 [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call Colin Ian King @ 2024-10-03 6:05 ` Sakari Ailus 2024-10-03 12:52 ` Tomi Valkeinen 2024-10-04 15:11 ` Tomi Valkeinen 2024-10-16 7:41 ` Mauro Carvalho Chehab 2 siblings, 1 reply; 9+ messages in thread From: Sakari Ailus @ 2024-10-03 6:05 UTC (permalink / raw) To: Colin Ian King Cc: Tomi Valkeinen, Mauro Carvalho Chehab, Andy Shevchenko, linux-media, kernel-janitors, linux-kernel Hi Colin, On Wed, Oct 02, 2024 at 05:53:29PM +0100, Colin Ian King wrote: > The function ub960_rxport_read is being called and afterwards ret is > being checked for any failures, however ret is not being assigned to > the return of the function call. Fix this by assigning ret to the > return of the call which appears to be missing. > > Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") > Signed-off-by: Colin Ian King <colin.i.king@gmail.com> > --- > drivers/media/i2c/ds90ub960.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c > index ffe5f25f8647..58424d8f72af 100644 > --- a/drivers/media/i2c/ds90ub960.c > +++ b/drivers/media/i2c/ds90ub960.c > @@ -1286,7 +1286,7 @@ static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, > > clk_delay += v & UB960_IR_RX_ANA_STROBE_SET_CLK_DELAY_MASK; > > - ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > + ret = ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > if (ret) > return ret; > There seems to be a similar issues all around the driver. It'd be good to fix them at the same time. -- Kind regards, Sakari Ailus ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call 2024-10-03 6:05 ` Sakari Ailus @ 2024-10-03 12:52 ` Tomi Valkeinen 2024-10-03 13:19 ` Sakari Ailus 0 siblings, 1 reply; 9+ messages in thread From: Tomi Valkeinen @ 2024-10-03 12:52 UTC (permalink / raw) To: Sakari Ailus, Colin Ian King Cc: Mauro Carvalho Chehab, Andy Shevchenko, linux-media, kernel-janitors, linux-kernel Hi, On 03/10/2024 09:05, Sakari Ailus wrote: > Hi Colin, > > On Wed, Oct 02, 2024 at 05:53:29PM +0100, Colin Ian King wrote: >> The function ub960_rxport_read is being called and afterwards ret is >> being checked for any failures, however ret is not being assigned to >> the return of the function call. Fix this by assigning ret to the >> return of the call which appears to be missing. >> >> Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") >> Signed-off-by: Colin Ian King <colin.i.king@gmail.com> >> --- >> drivers/media/i2c/ds90ub960.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c >> index ffe5f25f8647..58424d8f72af 100644 >> --- a/drivers/media/i2c/ds90ub960.c >> +++ b/drivers/media/i2c/ds90ub960.c >> @@ -1286,7 +1286,7 @@ static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, >> >> clk_delay += v & UB960_IR_RX_ANA_STROBE_SET_CLK_DELAY_MASK; >> >> - ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); >> + ret = ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); >> if (ret) >> return ret; >> > > There seems to be a similar issues all around the driver. It'd be good to > fix them at the same time. With similar issues, do you mean the code not checking the return value at all for i2c reads and writes? In this particular case the code already checks the return value, but setting the return value was missing. With a quick browse, I didn't see other like this. Tomi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call 2024-10-03 12:52 ` Tomi Valkeinen @ 2024-10-03 13:19 ` Sakari Ailus 2024-10-03 13:33 ` Tomi Valkeinen 0 siblings, 1 reply; 9+ messages in thread From: Sakari Ailus @ 2024-10-03 13:19 UTC (permalink / raw) To: Tomi Valkeinen Cc: Colin Ian King, Mauro Carvalho Chehab, Andy Shevchenko, linux-media, kernel-janitors, linux-kernel Moi, On Thu, Oct 03, 2024 at 03:52:17PM +0300, Tomi Valkeinen wrote: > Hi, > > On 03/10/2024 09:05, Sakari Ailus wrote: > > Hi Colin, > > > > On Wed, Oct 02, 2024 at 05:53:29PM +0100, Colin Ian King wrote: > > > The function ub960_rxport_read is being called and afterwards ret is > > > being checked for any failures, however ret is not being assigned to > > > the return of the function call. Fix this by assigning ret to the > > > return of the call which appears to be missing. > > > > > > Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") > > > Signed-off-by: Colin Ian King <colin.i.king@gmail.com> > > > --- > > > drivers/media/i2c/ds90ub960.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c > > > index ffe5f25f8647..58424d8f72af 100644 > > > --- a/drivers/media/i2c/ds90ub960.c > > > +++ b/drivers/media/i2c/ds90ub960.c > > > @@ -1286,7 +1286,7 @@ static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, > > > clk_delay += v & UB960_IR_RX_ANA_STROBE_SET_CLK_DELAY_MASK; > > > - ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > > > + ret = ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > > > if (ret) > > > return ret; > > > > There seems to be a similar issues all around the driver. It'd be good to > > fix them at the same time. > > With similar issues, do you mean the code not checking the return value at > all for i2c reads and writes? > > In this particular case the code already checks the return value, but > setting the return value was missing. With a quick browse, I didn't see > other like this. See e.g. ub960_clear_rx_errors(), ub960_log_status(), ub960_rxport_set_strobe_pos() and ub960_rxport_set_strobe_range. -- Terveisin, Sakari Ailus ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call 2024-10-03 13:19 ` Sakari Ailus @ 2024-10-03 13:33 ` Tomi Valkeinen 2024-10-03 15:13 ` Sakari Ailus 0 siblings, 1 reply; 9+ messages in thread From: Tomi Valkeinen @ 2024-10-03 13:33 UTC (permalink / raw) To: Sakari Ailus Cc: Colin Ian King, Mauro Carvalho Chehab, Andy Shevchenko, linux-media, kernel-janitors, linux-kernel On 03/10/2024 16:19, Sakari Ailus wrote: > Moi, > > On Thu, Oct 03, 2024 at 03:52:17PM +0300, Tomi Valkeinen wrote: >> Hi, >> >> On 03/10/2024 09:05, Sakari Ailus wrote: >>> Hi Colin, >>> >>> On Wed, Oct 02, 2024 at 05:53:29PM +0100, Colin Ian King wrote: >>>> The function ub960_rxport_read is being called and afterwards ret is >>>> being checked for any failures, however ret is not being assigned to >>>> the return of the function call. Fix this by assigning ret to the >>>> return of the call which appears to be missing. >>>> >>>> Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") >>>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com> >>>> --- >>>> drivers/media/i2c/ds90ub960.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c >>>> index ffe5f25f8647..58424d8f72af 100644 >>>> --- a/drivers/media/i2c/ds90ub960.c >>>> +++ b/drivers/media/i2c/ds90ub960.c >>>> @@ -1286,7 +1286,7 @@ static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, >>>> clk_delay += v & UB960_IR_RX_ANA_STROBE_SET_CLK_DELAY_MASK; >>>> - ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); >>>> + ret = ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); >>>> if (ret) >>>> return ret; >>> >>> There seems to be a similar issues all around the driver. It'd be good to >>> fix them at the same time. >> >> With similar issues, do you mean the code not checking the return value at >> all for i2c reads and writes? >> >> In this particular case the code already checks the return value, but >> setting the return value was missing. With a quick browse, I didn't see >> other like this. > > See e.g. ub960_clear_rx_errors(), ub960_log_status(), > ub960_rxport_set_strobe_pos() and ub960_rxport_set_strobe_range. Right, those don't check the return value. So they're not the same as the one fixed in this patch. I'm not arguing against adding error checks, but that's a big work and I think this patch is a different kind of fix which should be applied whether the additional error checks are added or not. Also, while still not arguing against adding the checks, it looks quite common to not check the returns values. E.g. it's not just a few errors I see if I add __must_check to cci functions. Tomi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call 2024-10-03 13:33 ` Tomi Valkeinen @ 2024-10-03 15:13 ` Sakari Ailus 0 siblings, 0 replies; 9+ messages in thread From: Sakari Ailus @ 2024-10-03 15:13 UTC (permalink / raw) To: Tomi Valkeinen Cc: Colin Ian King, Mauro Carvalho Chehab, Andy Shevchenko, linux-media, kernel-janitors, linux-kernel Moi, On Thu, Oct 03, 2024 at 04:33:54PM +0300, Tomi Valkeinen wrote: > On 03/10/2024 16:19, Sakari Ailus wrote: > > Moi, > > > > On Thu, Oct 03, 2024 at 03:52:17PM +0300, Tomi Valkeinen wrote: > > > Hi, > > > > > > On 03/10/2024 09:05, Sakari Ailus wrote: > > > > Hi Colin, > > > > > > > > On Wed, Oct 02, 2024 at 05:53:29PM +0100, Colin Ian King wrote: > > > > > The function ub960_rxport_read is being called and afterwards ret is > > > > > being checked for any failures, however ret is not being assigned to > > > > > the return of the function call. Fix this by assigning ret to the > > > > > return of the call which appears to be missing. > > > > > > > > > > Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") > > > > > Signed-off-by: Colin Ian King <colin.i.king@gmail.com> > > > > > --- > > > > > drivers/media/i2c/ds90ub960.c | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c > > > > > index ffe5f25f8647..58424d8f72af 100644 > > > > > --- a/drivers/media/i2c/ds90ub960.c > > > > > +++ b/drivers/media/i2c/ds90ub960.c > > > > > @@ -1286,7 +1286,7 @@ static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, > > > > > clk_delay += v & UB960_IR_RX_ANA_STROBE_SET_CLK_DELAY_MASK; > > > > > - ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > > > > > + ret = ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > > > > > if (ret) > > > > > return ret; > > > > > > > > There seems to be a similar issues all around the driver. It'd be good to > > > > fix them at the same time. > > > > > > With similar issues, do you mean the code not checking the return value at > > > all for i2c reads and writes? > > > > > > In this particular case the code already checks the return value, but > > > setting the return value was missing. With a quick browse, I didn't see > > > other like this. > > > > See e.g. ub960_clear_rx_errors(), ub960_log_status(), > > ub960_rxport_set_strobe_pos() and ub960_rxport_set_strobe_range. > > Right, those don't check the return value. So they're not the same as the > one fixed in this patch. > > I'm not arguing against adding error checks, but that's a big work and I > think this patch is a different kind of fix which should be applied whether > the additional error checks are added or not. How much of work that is really? It seems trivial, albeit there are a number of locations that need to be fixed. I'm fine with applying this but it'd be nice to add at least a FIXME: comment to the code while at it. > > Also, while still not arguing against adding the checks, it looks quite > common to not check the returns values. E.g. it's not just a few errors I > see if I add __must_check to cci functions. I haven't seen this being as widespread in pretty much any other (upstream) driver. -- Terveisin, Sakari Ailus ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call 2024-10-02 16:53 [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call Colin Ian King 2024-10-03 6:05 ` Sakari Ailus @ 2024-10-04 15:11 ` Tomi Valkeinen 2024-10-16 7:41 ` Mauro Carvalho Chehab 2 siblings, 0 replies; 9+ messages in thread From: Tomi Valkeinen @ 2024-10-04 15:11 UTC (permalink / raw) To: Colin Ian King, Mauro Carvalho Chehab, Andy Shevchenko, Sakari Ailus, linux-media Cc: kernel-janitors, linux-kernel On 02/10/2024 19:53, Colin Ian King wrote: > The function ub960_rxport_read is being called and afterwards ret is > being checked for any failures, however ret is not being assigned to > the return of the function call. Fix this by assigning ret to the > return of the call which appears to be missing. > > Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") > Signed-off-by: Colin Ian King <colin.i.king@gmail.com> > --- > drivers/media/i2c/ds90ub960.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c > index ffe5f25f8647..58424d8f72af 100644 > --- a/drivers/media/i2c/ds90ub960.c > +++ b/drivers/media/i2c/ds90ub960.c > @@ -1286,7 +1286,7 @@ static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, > > clk_delay += v & UB960_IR_RX_ANA_STROBE_SET_CLK_DELAY_MASK; > > - ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > + ret = ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > if (ret) > return ret; > Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Tomi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call 2024-10-02 16:53 [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call Colin Ian King 2024-10-03 6:05 ` Sakari Ailus 2024-10-04 15:11 ` Tomi Valkeinen @ 2024-10-16 7:41 ` Mauro Carvalho Chehab 2024-10-16 13:39 ` Dan Carpenter 2 siblings, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2024-10-16 7:41 UTC (permalink / raw) To: Colin Ian King Cc: Tomi Valkeinen, Mauro Carvalho Chehab, Andy Shevchenko, Sakari Ailus, linux-media, kernel-janitors, linux-kernel Em Wed, 2 Oct 2024 17:53:29 +0100 Colin Ian King <colin.i.king@gmail.com> escreveu: > The function ub960_rxport_read is being called and afterwards ret is > being checked for any failures, however ret is not being assigned to > the return of the function call. Fix this by assigning ret to the > return of the call which appears to be missing. > > Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") > Signed-off-by: Colin Ian King <colin.i.king@gmail.com> No Cc: stable. Please follow the submission rules for fixes as stated at: Documentation/process/stable-kernel-rules.rst In summary, all patches containing fixes shall have a Cc stable. There are rules there for the very few exceptions where a patch is not meant to be backported: Cc: <stable+noautosel@kernel.org> # reason goes here, and must be present > --- > drivers/media/i2c/ds90ub960.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c > index ffe5f25f8647..58424d8f72af 100644 > --- a/drivers/media/i2c/ds90ub960.c > +++ b/drivers/media/i2c/ds90ub960.c > @@ -1286,7 +1286,7 @@ static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, > > clk_delay += v & UB960_IR_RX_ANA_STROBE_SET_CLK_DELAY_MASK; > > - ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > + ret = ub960_rxport_read(priv, nport, UB960_RR_SFILTER_STS_1, &v); > if (ret) > return ret; > Thanks, Mauro ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call 2024-10-16 7:41 ` Mauro Carvalho Chehab @ 2024-10-16 13:39 ` Dan Carpenter 0 siblings, 0 replies; 9+ messages in thread From: Dan Carpenter @ 2024-10-16 13:39 UTC (permalink / raw) To: Mauro Carvalho Chehab Cc: Colin Ian King, Tomi Valkeinen, Mauro Carvalho Chehab, Andy Shevchenko, Sakari Ailus, linux-media, kernel-janitors, linux-kernel On Wed, Oct 16, 2024 at 09:41:11AM +0200, Mauro Carvalho Chehab wrote: > Em Wed, 2 Oct 2024 17:53:29 +0100 > Colin Ian King <colin.i.king@gmail.com> escreveu: > > > The function ub960_rxport_read is being called and afterwards ret is > > being checked for any failures, however ret is not being assigned to > > the return of the function call. Fix this by assigning ret to the > > return of the call which appears to be missing. > > > > Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") > > Signed-off-by: Colin Ian King <colin.i.king@gmail.com> > > No Cc: stable. Please follow the submission rules for fixes as stated > at: > Documentation/process/stable-kernel-rules.rst > > In summary, all patches containing fixes shall have a Cc stable. There > are rules there for the very few exceptions where a patch is not meant > to be backported: > > Cc: <stable+noautosel@kernel.org> # reason goes here, and must be present > I don't think this patch belongs in stable. It's doesn't fix a real life bug, it's just static checker stuff. I also don't think we should forbid it from going to stable if it's required as a dependency to backport a different patch. regards, dan carpenter ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-10-16 13:40 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-10-02 16:53 [PATCH][next] media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call Colin Ian King 2024-10-03 6:05 ` Sakari Ailus 2024-10-03 12:52 ` Tomi Valkeinen 2024-10-03 13:19 ` Sakari Ailus 2024-10-03 13:33 ` Tomi Valkeinen 2024-10-03 15:13 ` Sakari Ailus 2024-10-04 15:11 ` Tomi Valkeinen 2024-10-16 7:41 ` Mauro Carvalho Chehab 2024-10-16 13:39 ` Dan Carpenter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox