linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i2c: cpm: Remove linux,i2c-index conversion from be32
@ 2023-12-06 22:24 Christophe Leroy
  2023-12-08 11:12 ` Jochen Friedrich
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christophe Leroy @ 2023-12-06 22:24 UTC (permalink / raw)
  To: Jochen Friedrich, Andi Shyti
  Cc: kernel test robot, linuxppc-dev, linux-kernel, linux-i2c

sparse reports an error on some data that gets converted from be32.

That's because that data is typed u32 instead of __be32.

The type is correct, the be32_to_cpu() conversion is not.

Remove the conversion.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202312042210.QL4DA8Av-lkp@intel.com/
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v2: Use u32 directly, remove be32_to_cpu().
---
 drivers/i2c/busses/i2c-cpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index 9a664abf734d..771d60bc8d71 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -658,7 +658,7 @@ static int cpm_i2c_probe(struct platform_device *ofdev)
 	/* register new adapter to i2c module... */
 
 	data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len);
-	cpm->adap.nr = (data && len == 4) ? be32_to_cpup(data) : -1;
+	cpm->adap.nr = (data && len == 4) ? *data : -1;
 	result = i2c_add_numbered_adapter(&cpm->adap);
 
 	if (result < 0)
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] i2c: cpm: Remove linux,i2c-index conversion from be32
  2023-12-06 22:24 [PATCH v2] i2c: cpm: Remove linux,i2c-index conversion from be32 Christophe Leroy
@ 2023-12-08 11:12 ` Jochen Friedrich
  2023-12-09  0:10 ` Andi Shyti
  2023-12-19 17:19 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Jochen Friedrich @ 2023-12-08 11:12 UTC (permalink / raw)
  To: Christophe Leroy, Andi Shyti
  Cc: kernel test robot, linuxppc-dev, linux-kernel, linux-i2c

Acked-By: Jochen Friedrich <jochen@scram.de>

Am 06.12.2023 um 23:24 schrieb Christophe Leroy:
> sparse reports an error on some data that gets converted from be32.
>
> That's because that data is typed u32 instead of __be32.
>
> The type is correct, the be32_to_cpu() conversion is not.
>
> Remove the conversion.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202312042210.QL4DA8Av-lkp@intel.com/
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> v2: Use u32 directly, remove be32_to_cpu().
> ---
>   drivers/i2c/busses/i2c-cpm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index 9a664abf734d..771d60bc8d71 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -658,7 +658,7 @@ static int cpm_i2c_probe(struct platform_device *ofdev)
>   	/* register new adapter to i2c module... */
>   
>   	data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len);
> -	cpm->adap.nr = (data && len == 4) ? be32_to_cpup(data) : -1;
> +	cpm->adap.nr = (data && len == 4) ? *data : -1;
>   	result = i2c_add_numbered_adapter(&cpm->adap);
>   
>   	if (result < 0)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] i2c: cpm: Remove linux,i2c-index conversion from be32
  2023-12-06 22:24 [PATCH v2] i2c: cpm: Remove linux,i2c-index conversion from be32 Christophe Leroy
  2023-12-08 11:12 ` Jochen Friedrich
@ 2023-12-09  0:10 ` Andi Shyti
  2023-12-19 17:19 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2023-12-09  0:10 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: linux-i2c, kernel test robot, linuxppc-dev, linux-kernel

Hi Christophe,

On Wed, Dec 06, 2023 at 11:24:03PM +0100, Christophe Leroy wrote:
> sparse reports an error on some data that gets converted from be32.
> 
> That's because that data is typed u32 instead of __be32.
> 
> The type is correct, the be32_to_cpu() conversion is not.
> 
> Remove the conversion.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202312042210.QL4DA8Av-lkp@intel.com/
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> v2: Use u32 directly, remove be32_to_cpu().
> ---
>  drivers/i2c/busses/i2c-cpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index 9a664abf734d..771d60bc8d71 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -658,7 +658,7 @@ static int cpm_i2c_probe(struct platform_device *ofdev)
>  	/* register new adapter to i2c module... */
>  
>  	data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len);
> -	cpm->adap.nr = (data && len == 4) ? be32_to_cpup(data) : -1;
> +	cpm->adap.nr = (data && len == 4) ? *data : -1;

thanks!

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>

Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] i2c: cpm: Remove linux,i2c-index conversion from be32
  2023-12-06 22:24 [PATCH v2] i2c: cpm: Remove linux,i2c-index conversion from be32 Christophe Leroy
  2023-12-08 11:12 ` Jochen Friedrich
  2023-12-09  0:10 ` Andi Shyti
@ 2023-12-19 17:19 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2023-12-19 17:19 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: kernel test robot, linux-kernel, linux-i2c, linuxppc-dev,
	Andi Shyti

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

On Wed, Dec 06, 2023 at 11:24:03PM +0100, Christophe Leroy wrote:
> sparse reports an error on some data that gets converted from be32.
> 
> That's because that data is typed u32 instead of __be32.
> 
> The type is correct, the be32_to_cpu() conversion is not.
> 
> Remove the conversion.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202312042210.QL4DA8Av-lkp@intel.com/
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-19 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06 22:24 [PATCH v2] i2c: cpm: Remove linux,i2c-index conversion from be32 Christophe Leroy
2023-12-08 11:12 ` Jochen Friedrich
2023-12-09  0:10 ` Andi Shyti
2023-12-19 17:19 ` 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).