2024-01-22 21:07:58

by Charles Perry

[permalink] [raw]
Subject: [PATCH] bus: imx-weim: fix imx_weim_gpr_setup()

Commit 2a88e4792c6d ("bus: imx-weim: Remove open coded "ranges"
parsing") changes the parsing of the "ranges" field by using
for_each_of_range instead of of_property_for_each_u32. The number of
iteration of the loop is now equal to the number of range within
ranges. It is therefore no longer needed to check that i is divisible
by 4, otherwise, valid configurations will fail imx_weim_gpr_setup().

Fixes: 2a88e4792c6d ("bus: imx-weim: Remove open coded "ranges" parsing")
Signed-off-by: Charles Perry <[email protected]>
---
drivers/bus/imx-weim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c
index 6b5da73c85417..837bf9d51c6ec 100644
--- a/drivers/bus/imx-weim.c
+++ b/drivers/bus/imx-weim.c
@@ -120,7 +120,7 @@ static int imx_weim_gpr_setup(struct platform_device *pdev)
i++;
}

- if (i == 0 || i % 4)
+ if (i == 0)
goto err;

for (i = 0; i < ARRAY_SIZE(gprvals); i++) {
--
2.43.0



2024-02-06 07:07:39

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH] bus: imx-weim: fix imx_weim_gpr_setup()

On Mon, Jan 22, 2024 at 03:57:29PM -0500, Charles Perry wrote:
> Commit 2a88e4792c6d ("bus: imx-weim: Remove open coded "ranges"
> parsing") changes the parsing of the "ranges" field by using
> for_each_of_range instead of of_property_for_each_u32. The number of
> iteration of the loop is now equal to the number of range within
> ranges. It is therefore no longer needed to check that i is divisible
> by 4, otherwise, valid configurations will fail imx_weim_gpr_setup().
>
> Fixes: 2a88e4792c6d ("bus: imx-weim: Remove open coded "ranges" parsing")
> Signed-off-by: Charles Perry <[email protected]>

Thanks for the patch! But I have picked up the one [1] from Lucas.

Shawn

[1] https://lore.kernel.org/all/[email protected]/

> ---
> drivers/bus/imx-weim.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c
> index 6b5da73c85417..837bf9d51c6ec 100644
> --- a/drivers/bus/imx-weim.c
> +++ b/drivers/bus/imx-weim.c
> @@ -120,7 +120,7 @@ static int imx_weim_gpr_setup(struct platform_device *pdev)
> i++;
> }
>
> - if (i == 0 || i % 4)
> + if (i == 0)
> goto err;
>
> for (i = 0; i < ARRAY_SIZE(gprvals); i++) {
> --
> 2.43.0
>