i2c: mt65xx: convert set_speed function to void
PATCH 1/1 i2c: mt65xx: convert set_speed function to void
cppcheck rightfully reports:drivers/i2c/busses/i2c-mt65xx.c:1464:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]
Make the function void and simplify the code.
Signed-off-by Wolfram Sang <[email protected]>
--- drivers/i2c/busses/i2c-mt65xx.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/i2c/busses/i2c-mt65xx.c +2 -9
@@ -868,7 +868,7 @@ static int mtk_i2c_calculate_speed(struct mtk_i2c *i2c, unsigned int clk_src,return 0 ; } -static int mtk_i2c_set_speed (struct mtk_i2c *i2c,unsigned int parent_clk) +static void mtk_i2c_set_speed (struct mtk_i2c *i2c,unsigned int parent_clk) {unsigned int clk_src;unsigned int step_cnt;
@@ -938,9 +938,6 @@ static int mtk_i2c_set_speed(struct mtk_i2c *i2c, unsigned int parent_clk)break ; } - - -return 0 ; }static void i2c_dump_register (struct mtk_i2c *i2c)
@@ -1460,11 +1457,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)strscpy (i2c->adap.name,I2C_DRV_NAME ,sizeof (i2c->adap.name)); - ret =mtk_i2c_set_speed (i2c,clk_get_rate (i2c->clocks[speed_clk].clk)); -if (ret) { -dev_err (&pdev->dev,"Failed to set the speed.\n" ); -return -EINVAL ; - } +mtk_i2c_set_speed (i2c,clk_get_rate (i2c->clocks[speed_clk].clk));if (i2c->dev_comp->max_dma_support >32 ) { ret = dma_set_mask(&pdev->dev,
Signature · 1 line
2.47.2
Il 25/09/25 23:05, Wolfram Sang ha scritto:
Quoted 6 lines
cppcheck rightfully reports:
drivers/i2c/busses/i2c-mt65xx.c:1464:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]Make the function void and simplify the code.
Signed-off-by Wolfram Sang <[email protected]>
Reviewed-by AngeloGioacchino Del Regno <[email protected]>
Quoted 40 lines
--- drivers/i2c/busses/i2c-mt65xx.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)drivers/i2c/busses/i2c-mt65xx.c +2
-9@@ -868,7 +868,7 @@ static int mtk_i2c_calculate_speed(struct mtk_i2c *i2c, unsigned int clk_src,return 0 ; } -static int mtk_i2c_set_speed (struct mtk_i2c *i2c,unsigned int parent_clk) +static void mtk_i2c_set_speed (struct mtk_i2c *i2c,unsigned int parent_clk) {unsigned int clk_src;unsigned int step_cnt;@@ -938,9 +938,6 @@ static int mtk_i2c_set_speed(struct mtk_i2c *i2c, unsigned int parent_clk)break ; } - - -return 0 ; }static void i2c_dump_register (struct mtk_i2c *i2c)@@ -1460,11 +1457,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)strscpy (i2c->adap.name,I2C_DRV_NAME ,sizeof (i2c->adap.name)); - ret =mtk_i2c_set_speed (i2c,clk_get_rate (i2c->clocks[speed_clk].clk)); -if (ret) { -dev_err (&pdev->dev,"Failed to set the speed.\n" ); -return -EINVAL ; - } +mtk_i2c_set_speed (i2c,clk_get_rate (i2c->clocks[speed_clk].clk));if (i2c->dev_comp->max_dma_support >32 ) { ret = dma_set_mask(&pdev->dev,
Wolfram Sang
AppliedQuoted 6 lines · Wolfram Sang
cppcheck rightfully reports:
drivers/i2c/busses/i2c-mt65xx.c:1464:6: warning: Condition 'ret' is always false [knownConditionTrueFalse]Make the function void and simplify the code.
Signed-off-by Wolfram Sang <[email protected]>
Applied to for-next, thanks!