drm/bridge: parade-ps8640: check return values in ps8640_aux_transfer()
Subsystems (5)
PATCH 1/1 drm/bridge: parade-ps8640: check return values in ps8640_aux_transfer()
Coverity complains of an unused return code:
CID 120459 (#1 of 1): Unchecked return value (CHECKED_RETURN)
7. check_return: Calling regmap_bulk_write without checking return value (as is done elsewhere 199 out of 291 times).
204 regmap_bulk_write(map, PAGE0_SWAUX_ADDR_7_0, addr_len,
205 ARRAY_SIZE(addr_len));
While I was at it I noticed 2 other places where return codes were not being used, or used incorrectly (which is a real bug).
Fix these errors by correctly using the returned error codes.
--- drivers/gpu/drm/bridge/parade-ps8640.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/bridge/parade-ps8640.c +11 -3
@@ -201,8 +201,12 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, addr_len[PAGE0_SWAUX_LENGTH - base] = (len ==0 ) ?SWAUX_NO_PAYLOAD : ((len -1 ) &SWAUX_LENGTH_MASK ); -regmap_bulk_write (map,PAGE0_SWAUX_ADDR_7_0 , addr_len, + ret =regmap_bulk_write (map,PAGE0_SWAUX_ADDR_7_0 , addr_len,ARRAY_SIZE (addr_len)); +if (ret) { +DRM_DEV_ERROR (dev,"failed to bulk write ADDR_7_0: %d\n" , ret); +return ret; + }if (len && (request ==DP_AUX_NATIVE_WRITE || request ==DP_AUX_I2C_WRITE )) {
@@ -218,13 +222,17 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, } } -regmap_write (map,PAGE0_SWAUX_CTRL ,SWAUX_SEND ); + ret =regmap_write (map,PAGE0_SWAUX_CTRL ,SWAUX_SEND ); +if (ret) { +DRM_DEV_ERROR (dev,"failed to write SEND: %d\n" , ret); +return ret; + }/* Zero delay loop because i2c transactions are slow already */ regmap_read_poll_timeout (map,PAGE0_SWAUX_CTRL , data, !(data &SWAUX_SEND ),0 ,50 *1000 ); -regmap_read (map,PAGE0_SWAUX_STATUS , &data); + ret =regmap_read (map,PAGE0_SWAUX_STATUS , &data);if (ret) {DRM_DEV_ERROR (dev,"failed to read PAGE0_SWAUX_STATUS: %d\n" , ret);
Signature · 1 line
2.33.0
Quoted 60 lines · Tim Gardner
Coverity complains of an unused return code:
CID 120459 (#1 of 1): Unchecked return value (
CHECKED_RETURN)
7.check_return: Callingregmap_bulk_writewithout checking return value (as is done elsewhere 199 out of 291 times).
204 regmap_bulk_write(map,PAGE0_SWAUX_ADDR_7_0,addr_len,
205ARRAY_SIZE(addr_len));While I was at it I noticed 2 other places where return codes were not being used, or used incorrectly (which is a real bug).
Fix these errors by correctly using the returned error codes.
Cc William Breathitt Gray <[email protected]>Cc Syed Nayyar Waris <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Neil Armstrong <[email protected]>Cc Robert Foss <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Jonas Karlman <[email protected]>Cc Jernej Skrabec <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Tim Gardner <[email protected]>--- drivers/gpu/drm/bridge/parade-ps8640.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/parade-ps8640.c +10
-2@@ -201,8 +201,12 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, addr_len[PAGE0_SWAUX_LENGTH - base] = (len ==0 ) ?SWAUX_NO_PAYLOAD : ((len -1 ) &SWAUX_LENGTH_MASK ); -regmap_bulk_write (map,PAGE0_SWAUX_ADDR_7_0 , addr_len, + ret =regmap_bulk_write (map,PAGE0_SWAUX_ADDR_7_0 , addr_len,ARRAY_SIZE (addr_len)); +if (ret) { +DRM_DEV_ERROR (dev,"failed to bulk write ADDR_7_0: %d\n" , ret); +return ret; + }if (len && (request ==DP_AUX_NATIVE_WRITE || request ==DP_AUX_I2C_WRITE )) {@@ -218,13 +222,17 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, } } -regmap_write (map,PAGE0_SWAUX_CTRL ,SWAUX_SEND ); + ret =regmap_write (map,PAGE0_SWAUX_CTRL ,SWAUX_SEND ); +if (ret) { +DRM_DEV_ERROR (dev,"failed to write SEND: %d\n" , ret); +return ret; + }
drivers/gpu/drm/bridge/parade-ps8640.c static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, · line 238
Quoted 10 lines
drivers/gpu/drm/bridge/parade-ps8640.c +1
-1/* Zero delay loop because i2c transactions are slow already */ regmap_read_poll_timeout (map,PAGE0_SWAUX_CTRL , data, !(data &SWAUX_SEND ),0 ,50 *1000 ); -regmap_read (map,PAGE0_SWAUX_STATUS , &data); + ret =regmap_read (map,PAGE0_SWAUX_STATUS , &data);if (ret) {DRM_DEV_ERROR (dev,"failed to read PAGE0_SWAUX_STATUS: %d\n" , ret);
I forgot to mention this patch is for linux-next next-20210924.
-----------
Tim Gardner
Canonical, Inc
Quoted 76 lines · Tim Gardner
Quoted 60 lines · Tim Gardner
Coverity complains of an unused return code:
CID 120459 (#1 of 1): Unchecked return value (
CHECKED_RETURN)
7.check_return: Callingregmap_bulk_writewithout checking return value (as is done elsewhere 199 out of 291 times).
204 regmap_bulk_write(map,PAGE0_SWAUX_ADDR_7_0,addr_len,
205ARRAY_SIZE(addr_len));While I was at it I noticed 2 other places where return codes were not being used, or used incorrectly (which is a real bug).
Fix these errors by correctly using the returned error codes.
Cc William Breathitt Gray <[email protected]>Cc Syed Nayyar Waris <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Neil Armstrong <[email protected]>Cc Robert Foss <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Jonas Karlman <[email protected]>Cc Jernej Skrabec <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Tim Gardner <[email protected]>--- drivers/gpu/drm/bridge/parade-ps8640.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/parade-ps8640.c +10
-2@@ -201,8 +201,12 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, addr_len[PAGE0_SWAUX_LENGTH - base] = (len ==0 ) ?SWAUX_NO_PAYLOAD : ((len -1 ) &SWAUX_LENGTH_MASK ); -regmap_bulk_write (map,PAGE0_SWAUX_ADDR_7_0 , addr_len, + ret =regmap_bulk_write (map,PAGE0_SWAUX_ADDR_7_0 , addr_len,ARRAY_SIZE (addr_len)); +if (ret) { +DRM_DEV_ERROR (dev,"failed to bulk write ADDR_7_0: %d\n" , ret); +return ret; + }if (len && (request ==DP_AUX_NATIVE_WRITE || request ==DP_AUX_I2C_WRITE )) {@@ -218,13 +222,17 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, } } -regmap_write (map,PAGE0_SWAUX_CTRL ,SWAUX_SEND ); + ret =regmap_write (map,PAGE0_SWAUX_CTRL ,SWAUX_SEND ); +if (ret) { +DRM_DEV_ERROR (dev,"failed to write SEND: %d\n" , ret); +return ret; + }drivers/gpu/drm/bridge/parade-ps8640.c static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, · line 238
Quoted 10 lines
drivers/gpu/drm/bridge/parade-ps8640.c +1
-1/* Zero delay loop because i2c transactions are slow already */ regmap_read_poll_timeout (map,PAGE0_SWAUX_CTRL , data, !(data &SWAUX_SEND ),0 ,50 *1000 ); -regmap_read (map,PAGE0_SWAUX_STATUS , &data); + ret =regmap_read (map,PAGE0_SWAUX_STATUS , &data);if (ret) {DRM_DEV_ERROR (dev,"failed to read PAGE0_SWAUX_STATUS: %d\n" , ret);I forgot to mention this patch is for linux-next next-20210924.
Quoted 3 lines
-----------
Tim Gardner
Canonical, Inc
Hi Tim,
For future patches, the git format-patch command has a useful option '--base'. It will allow you to provide the base tree information for users and maintainers so that they know where to apply the patch:
https://git-scm.com/docs/git-format-patch#_base_tree_information
Sincerely,
William Breathitt Gray
Hey Tim,
Thanks for submitting this.
I'm seeing some checkpatch --strict warnings. Could you fix them and resubmit the series?
Quoted 5 lines · Tim Gardner
Coverity complains of an unused return code:
CID 120459 (#1 of 1): Unchecked return value (
CHECKED_RETURN)
7.check_return: Callingregmap_bulk_writewithout checking return value (as is
Checkpatch is unhappy about the length of this line.
Quoted 32 lines
done elsewhere 199 out of 291 times).
204 regmap_bulk_write(map,PAGE0_SWAUX_ADDR_7_0,addr_len,
205ARRAY_SIZE(addr_len));While I was at it I noticed 2 other places where return codes were not being used, or used incorrectly (which is a real bug).
Fix these errors by correctly using the returned error codes.
Cc William Breathitt Gray <[email protected]>Cc Syed Nayyar Waris <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Neil Armstrong <[email protected]>Cc Robert Foss <[email protected]>Cc Laurent Pinchart <[email protected]>Cc Jonas Karlman <[email protected]>Cc Jernej Skrabec <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Tim Gardner <[email protected]>--- drivers/gpu/drm/bridge/parade-ps8640.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/bridge/parade-ps8640.c +0
-0
drivers/gpu/drm/bridge/parade-ps8640.c static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, · line 205
Quoted 6 lines
drivers/gpu/drm/bridge/parade-ps8640.c +1
-1@@ -201,8 +201,12 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, addr_len[PAGE0_SWAUX_LENGTH - base] = (len ==0 ) ?SWAUX_NO_PAYLOAD : ((len -1 ) &SWAUX_LENGTH_MASK ); -regmap_bulk_write (map,PAGE0_SWAUX_ADDR_7_0 , addr_len, + ret =regmap_bulk_write (map,PAGE0_SWAUX_ADDR_7_0 , addr_len,ARRAY_SIZE (addr_len));
Align to open parenthesis.
Quoted 30 lines
drivers/gpu/drm/bridge/parade-ps8640.c +10
-3+if (ret) { +DRM_DEV_ERROR (dev,"failed to bulk write ADDR_7_0: %d\n" , ret); +return ret; + }if (len && (request ==DP_AUX_NATIVE_WRITE || request ==DP_AUX_I2C_WRITE )) {@@ -218,13 +222,17 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, } } -regmap_write (map,PAGE0_SWAUX_CTRL ,SWAUX_SEND ); + ret =regmap_write (map,PAGE0_SWAUX_CTRL ,SWAUX_SEND ); +if (ret) { +DRM_DEV_ERROR (dev,"failed to write SEND: %d\n" , ret); +return ret; + }/* Zero delay loop because i2c transactions are slow already */ regmap_read_poll_timeout (map,PAGE0_SWAUX_CTRL , data, !(data &SWAUX_SEND ),0 ,50 *1000 ); -regmap_read (map,PAGE0_SWAUX_STATUS , &data); + ret =regmap_read (map,PAGE0_SWAUX_STATUS , &data);if (ret) {DRM_DEV_ERROR (dev,"failed to read PAGE0_SWAUX_STATUS: %d\n" , ret); --2.33.0