media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call
Subsystems (3)
PATCH 1/1 media: i2c: ds90ub960: Fix missing return check on ub960_rxport_read call
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.
--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ds90ub960.c +1 -1
@@ -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;
Signature · 1 line
2.39.5
Hi Colin,
Quoted 16 lines · Colin Ian King
The function
ub960_rxport_readis 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 <[email protected]>--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/ds90ub960.c +0
-0
drivers/media/i2c/ds90ub960.c static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, · line 1292
Quoted 8 lines
drivers/media/i2c/ds90ub960.c +1
-1@@ -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.
Signature · 3 lines
Kind regards, Sakari Ailus
Tomi Valkeinen
maintainerHi,
Quoted 22 lines · Sakari Ailus
Hi Colin,
Quoted 19 lines · Colin Ian King
The function
ub960_rxport_readis 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 <[email protected]>--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/ds90ub960.c +0
-0@@ -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 ;
Quoted 8 lines
drivers/media/i2c/ds90ub960.c static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, · line 1292
Quoted 5 lines
drivers/media/i2c/ds90ub960.c +1
-1-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
Moi,
Quoted 31 lines · Tomi Valkeinen
Hi,
Quoted 14 lines · Sakari Ailus
Hi Colin,
Quoted 11 lines · Colin Ian King
The function
ub960_rxport_readis 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 <[email protected]>--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/media/i2c/ds90ub960.c static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, · line 1289
Quoted 10 lines
drivers/media/i2c/ds90ub960.c +1
-1@@ -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.
Quoted 6 lines
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.
Signature · 3 lines
Terveisin, Sakari Ailus
Tomi Valkeinen
maintainerQuoted 37 lines · Sakari Ailus
Moi,
Quoted 34 lines · Tomi Valkeinen
Hi,
Quoted 14 lines · Sakari Ailus
Hi Colin,
Quoted 11 lines · Colin Ian King
The function
ub960_rxport_readis 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 <[email protected]>--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/media/i2c/ds90ub960.c static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, · line 1289
Quoted 10 lines
drivers/media/i2c/ds90ub960.c +1
-1@@ -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?
Quoted 6 lines
Quoted 3 lines
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()andub960_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
Moi,
Quoted 45 lines · Tomi Valkeinen
Quoted 37 lines · Sakari Ailus
Moi,
Quoted 34 lines · Tomi Valkeinen
Hi,
Quoted 14 lines · Sakari Ailus
Hi Colin,
Quoted 11 lines · Colin Ian King
The function
ub960_rxport_readis 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 <[email protected]>--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/media/i2c/ds90ub960.c static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, · line 1289
Quoted 10 lines
drivers/media/i2c/ds90ub960.c +1
-1@@ -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?
Quoted 6 lines
Quoted 3 lines
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()andub960_rxport_set_strobe_range.
Quoted 6 lines
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.
Quoted 4 lines
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_checkto cci functions.
I haven't seen this being as widespread in pretty much any other (upstream) driver.
Signature · 3 lines
Terveisin, Sakari Ailus
Quoted 16 lines · Colin Ian King
The function
ub960_rxport_readis 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 <[email protected]>--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/ds90ub960.c +0
-0
drivers/media/i2c/ds90ub960.c static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, · line 1292
Quoted 8 lines
drivers/media/i2c/ds90ub960.c +1
-1@@ -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;
Tomi
Em Wed, 2 Oct 2024 17:53:29 +0100
Colin Ian King <[email protected]> escreveu:
Quoted 7 lines
The function
ub960_rxport_readis 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 <[email protected]>
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:
Quoted 9 lines
--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/ds90ub960.c +0
-0
drivers/media/i2c/ds90ub960.c static int ub960_rxport_get_strobe_pos(struct ub960_data *priv, · line 1292
Quoted 8 lines
drivers/media/i2c/ds90ub960.c +1
-1@@ -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
Quoted 15 lines · Mauro Carvalho Chehab
Em Wed, 2 Oct 2024 17:53:29 +0100
Colin Ian King <[email protected]> escreveu:Quoted 7 lines
The function
ub960_rxport_readis 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 <[email protected]>No Cc: stable. Please follow the submission rules for fixes as stated at:
Documentation/process/stable-kernel-rules.rst
Quoted 6 lines
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 <[email protected]> # 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