diff mbox series

i2c: iproc: Remove redundant error checks for bcm_iproc_i2c_init

Message ID 20250120090334.1705-1-vulab@iscas.ac.cn (mailing list archive)
State New
Headers show
Series i2c: iproc: Remove redundant error checks for bcm_iproc_i2c_init | expand

Commit Message

Wentao Liang Jan. 20, 2025, 9:03 a.m. UTC
The bcm_iproc_i2c_init() always returns 0. As a result, there
is no need to check its return value or handle errors.

This change removes the redundant error handling code after
calls to bcm_iproc_i2c_init() in both the bcm_iproc_i2c_probe()
and bcm_iproc_i2c_resume().

Fixes: e6e5dd3566e0 ("i2c: iproc: Add Broadcom iProc I2C Driver")
Fixes: 0ee04e91eacd ("i2c: iproc: Add suspend/resume support")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/i2c/busses/i2c-bcm-iproc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Uwe Kleine-König Jan. 20, 2025, 2:59 p.m. UTC | #1
On Mon, Jan 20, 2025 at 05:03:34PM +0800, Wentao Liang wrote:
> The bcm_iproc_i2c_init() always returns 0. As a result, there
> is no need to check its return value or handle errors.
> 
> This change removes the redundant error handling code after
> calls to bcm_iproc_i2c_init() in both the bcm_iproc_i2c_probe()
> and bcm_iproc_i2c_resume().
> 
> Fixes: e6e5dd3566e0 ("i2c: iproc: Add Broadcom iProc I2C Driver")
> Fixes: 0ee04e91eacd ("i2c: iproc: Add suspend/resume support")

I would drop the Fixes lines.

> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  drivers/i2c/busses/i2c-bcm-iproc.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
> index 15b632a146e1..c683715093d7 100644
> --- a/drivers/i2c/busses/i2c-bcm-iproc.c
> +++ b/drivers/i2c/busses/i2c-bcm-iproc.c
> @@ -1081,9 +1081,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
>  		bcm_iproc_algo.unreg_slave = NULL;
>  	}
>  
> -	ret = bcm_iproc_i2c_init(iproc_i2c);
> -	if (ret)
> -		return ret;
> +	bcm_iproc_i2c_init(iproc_i2c);

If you change the prototype to also "return" void, that looks good.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c
index 15b632a146e1..c683715093d7 100644
--- a/drivers/i2c/busses/i2c-bcm-iproc.c
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -1081,9 +1081,7 @@  static int bcm_iproc_i2c_probe(struct platform_device *pdev)
 		bcm_iproc_algo.unreg_slave = NULL;
 	}
 
-	ret = bcm_iproc_i2c_init(iproc_i2c);
-	if (ret)
-		return ret;
+	bcm_iproc_i2c_init(iproc_i2c);
 
 	ret = bcm_iproc_i2c_cfg_speed(iproc_i2c);
 	if (ret)
@@ -1169,9 +1167,7 @@  static int bcm_iproc_i2c_resume(struct device *dev)
 	 * Power domain could have been shut off completely in system deep
 	 * sleep, so re-initialize the block here
 	 */
-	ret = bcm_iproc_i2c_init(iproc_i2c);
-	if (ret)
-		return ret;
+	bcm_iproc_i2c_init(iproc_i2c);
 
 	/* configure to the desired bus speed */
 	val = iproc_i2c_rd_reg(iproc_i2c, TIM_CFG_OFFSET);