All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc/tegra: fuse: Explicitly cast to/from __iomem
@ 2022-02-24 12:27 Thierry Reding
  2022-02-24 14:37 ` Dmitry Osipenko
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2022-02-24 12:27 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jon Hunter, Dmitry Osipenko, linux-tegra, kernel test robot

From: Thierry Reding <treding@nvidia.com>

sparse is picky about casts between different address spaces. A cast to
plain void * needs to be accompanied by a __force modifier and casting
back to void __iomem * needs to be explicit to avoid warnings.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 88724b78a84c ("soc/tegra: fuse: Use resource-managed helpers")
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 10d2ae99babd..aa94fda282f4 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -202,8 +202,8 @@ static const struct nvmem_cell_info tegra_fuse_cells[] = {
 
 static void tegra_fuse_restore(void *base)
 {
+	fuse->base = (void __iomem *)base;
 	fuse->clk = NULL;
-	fuse->base = base;
 }
 
 static int tegra_fuse_probe(struct platform_device *pdev)
@@ -213,7 +213,7 @@ static int tegra_fuse_probe(struct platform_device *pdev)
 	struct resource *res;
 	int err;
 
-	err = devm_add_action(&pdev->dev, tegra_fuse_restore, base);
+	err = devm_add_action(&pdev->dev, tegra_fuse_restore, (void __force *)base);
 	if (err)
 		return err;
 
-- 
2.35.1


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

* Re: [PATCH] soc/tegra: fuse: Explicitly cast to/from __iomem
  2022-02-24 12:27 [PATCH] soc/tegra: fuse: Explicitly cast to/from __iomem Thierry Reding
@ 2022-02-24 14:37 ` Dmitry Osipenko
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Osipenko @ 2022-02-24 14:37 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jon Hunter, Dmitry Osipenko, linux-tegra, kernel test robot


On 2/24/22 15:27, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> sparse is picky about casts between different address spaces. A cast to
> plain void * needs to be accompanied by a __force modifier and casting
> back to void __iomem * needs to be explicit to avoid warnings.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: 88724b78a84c ("soc/tegra: fuse: Use resource-managed helpers")
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/soc/tegra/fuse/fuse-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
> index 10d2ae99babd..aa94fda282f4 100644
> --- a/drivers/soc/tegra/fuse/fuse-tegra.c
> +++ b/drivers/soc/tegra/fuse/fuse-tegra.c
> @@ -202,8 +202,8 @@ static const struct nvmem_cell_info tegra_fuse_cells[] = {
>  
>  static void tegra_fuse_restore(void *base)
>  {
> +	fuse->base = (void __iomem *)base;
>  	fuse->clk = NULL;
> -	fuse->base = base;
>  }
>  
>  static int tegra_fuse_probe(struct platform_device *pdev)
> @@ -213,7 +213,7 @@ static int tegra_fuse_probe(struct platform_device *pdev)
>  	struct resource *res;
>  	int err;
>  
> -	err = devm_add_action(&pdev->dev, tegra_fuse_restore, base);
> +	err = devm_add_action(&pdev->dev, tegra_fuse_restore, (void __force *)base);
>  	if (err)
>  		return err;
>  

Thank you, I had the same change on my mind.

Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

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

end of thread, other threads:[~2022-02-24 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 12:27 [PATCH] soc/tegra: fuse: Explicitly cast to/from __iomem Thierry Reding
2022-02-24 14:37 ` Dmitry Osipenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.