Skip to content

Commit 39f8d63

Browse files
ISCAS-VulabAndi Shyti
authored andcommitted
i2c: iproc: Refactor prototype and remove redundant error checks
The bcm_iproc_i2c_init() always returns 0. As a result, there is no need to check its return value or handle errors. This patch changes the prototype of bcm_iproc_i2c_init() to return void and 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(). Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Link: https://lore.kernel.org/r/20250121084818.2719-1-vulab@iscas.ac.cn Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
1 parent a815975 commit 39f8d63

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

drivers/i2c/busses/i2c-bcm-iproc.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ static irqreturn_t bcm_iproc_i2c_isr(int irq, void *data)
678678
return IRQ_HANDLED;
679679
}
680680

681-
static int bcm_iproc_i2c_init(struct bcm_iproc_i2c_dev *iproc_i2c)
681+
static void bcm_iproc_i2c_init(struct bcm_iproc_i2c_dev *iproc_i2c)
682682
{
683683
u32 val;
684684

@@ -706,8 +706,6 @@ static int bcm_iproc_i2c_init(struct bcm_iproc_i2c_dev *iproc_i2c)
706706

707707
/* clear all pending interrupts */
708708
iproc_i2c_wr_reg(iproc_i2c, IS_OFFSET, 0xffffffff);
709-
710-
return 0;
711709
}
712710

713711
static void bcm_iproc_i2c_enable_disable(struct bcm_iproc_i2c_dev *iproc_i2c,
@@ -1081,9 +1079,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
10811079
bcm_iproc_algo.unreg_slave = NULL;
10821080
}
10831081

1084-
ret = bcm_iproc_i2c_init(iproc_i2c);
1085-
if (ret)
1086-
return ret;
1082+
bcm_iproc_i2c_init(iproc_i2c);
10871083

10881084
ret = bcm_iproc_i2c_cfg_speed(iproc_i2c);
10891085
if (ret)
@@ -1162,16 +1158,13 @@ static int bcm_iproc_i2c_suspend(struct device *dev)
11621158
static int bcm_iproc_i2c_resume(struct device *dev)
11631159
{
11641160
struct bcm_iproc_i2c_dev *iproc_i2c = dev_get_drvdata(dev);
1165-
int ret;
11661161
u32 val;
11671162

11681163
/*
11691164
* Power domain could have been shut off completely in system deep
11701165
* sleep, so re-initialize the block here
11711166
*/
1172-
ret = bcm_iproc_i2c_init(iproc_i2c);
1173-
if (ret)
1174-
return ret;
1167+
bcm_iproc_i2c_init(iproc_i2c);
11751168

11761169
/* configure to the desired bus speed */
11771170
val = iproc_i2c_rd_reg(iproc_i2c, TIM_CFG_OFFSET);

0 commit comments

Comments
 (0)