* [PATCH] i2c: mt65xx: convert set_speed function to void
@ 2025-09-25 21:05 Wolfram Sang
2025-09-29 10:19 ` AngeloGioacchino Del Regno
2025-10-04 16:46 ` Wolfram Sang
0 siblings, 2 replies; 3+ messages in thread
From: Wolfram Sang @ 2025-09-25 21:05 UTC (permalink / raw)
To: linux-i2c
Cc: Wolfram Sang, Qii Wang, Andi Shyti, Matthias Brugger,
AngeloGioacchino Del Regno, linux-arm-kernel, linux-mediatek
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 <wsa+renesas@sang-engineering.com>
---
drivers/i2c/busses/i2c-mt65xx.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index dee40704825c..aefdbee1f03c 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -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,
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] i2c: mt65xx: convert set_speed function to void
2025-09-25 21:05 [PATCH] i2c: mt65xx: convert set_speed function to void Wolfram Sang
@ 2025-09-29 10:19 ` AngeloGioacchino Del Regno
2025-10-04 16:46 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-09-29 10:19 UTC (permalink / raw)
To: Wolfram Sang, linux-i2c
Cc: Qii Wang, Andi Shyti, Matthias Brugger, linux-arm-kernel,
linux-mediatek
Il 25/09/25 23:05, Wolfram Sang ha scritto:
> 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 <wsa+renesas@sang-engineering.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> drivers/i2c/busses/i2c-mt65xx.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
> index dee40704825c..aefdbee1f03c 100644
> --- a/drivers/i2c/busses/i2c-mt65xx.c
> +++ b/drivers/i2c/busses/i2c-mt65xx.c
> @@ -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,
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] i2c: mt65xx: convert set_speed function to void
2025-09-25 21:05 [PATCH] i2c: mt65xx: convert set_speed function to void Wolfram Sang
2025-09-29 10:19 ` AngeloGioacchino Del Regno
@ 2025-10-04 16:46 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2025-10-04 16:46 UTC (permalink / raw)
To: linux-i2c
Cc: Qii Wang, Andi Shyti, Matthias Brugger,
AngeloGioacchino Del Regno, linux-arm-kernel, linux-mediatek
On Thu, Sep 25, 2025 at 11:05:18PM +0200, Wolfram Sang wrote:
> 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 <wsa+renesas@sang-engineering.com>
Applied to for-next, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-04 16:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 21:05 [PATCH] i2c: mt65xx: convert set_speed function to void Wolfram Sang
2025-09-29 10:19 ` AngeloGioacchino Del Regno
2025-10-04 16:46 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).