linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] power: reset: at91-reset: use devm_of_iomap
@ 2021-04-02 10:50 Claudiu Beznea
  2021-04-02 11:13 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Claudiu Beznea @ 2021-04-02 10:50 UTC (permalink / raw)
  To: sre, nicolas.ferre, alexandre.belloni, ludovic.desroches
  Cc: linux-pm, linux-arm-kernel, linux-kernel, Claudiu Beznea,
	kernel test robot, Dan Carpenter

Use devm_of_iomap() to map resources. This will avoid the necessity to
track the mapped resources and free them on failure path or on remove.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---

Changes in v2:
- use devm_of_iomap()
- change commit description and title to match to the new approach
- add Suggested-by tag

 drivers/power/reset/at91-reset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 3ff9d93a5226..026649409135 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -192,7 +192,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
 	if (!reset)
 		return -ENOMEM;
 
-	reset->rstc_base = of_iomap(pdev->dev.of_node, 0);
+	reset->rstc_base = devm_of_iomap(&pdev->dev, pdev->dev.of_node, 0, NULL);
 	if (!reset->rstc_base) {
 		dev_err(&pdev->dev, "Could not map reset controller address\n");
 		return -ENODEV;
@@ -202,7 +202,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
 		/* we need to shutdown the ddr controller, so get ramc base */
 		for_each_matching_node_and_match(np, at91_ramc_of_match, &match) {
 			reset->ramc_lpr = (u32)match->data;
-			reset->ramc_base[idx] = of_iomap(np, 0);
+			reset->ramc_base[idx] = devm_of_iomap(&pdev->dev, np, 0, NULL);
 			if (!reset->ramc_base[idx]) {
 				dev_err(&pdev->dev, "Could not map ram controller address\n");
 				of_node_put(np);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 1/1] power: reset: at91-reset: use devm_of_iomap
  2021-04-02 10:50 [PATCH v2 1/1] power: reset: at91-reset: use devm_of_iomap Claudiu Beznea
@ 2021-04-02 11:13 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2021-04-02 11:13 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: alexandre.belloni, kernel test robot, linux-pm, linux-kernel,
	ludovic.desroches, Dan Carpenter, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1892 bytes --]

Hi,

On Fri, Apr 02, 2021 at 01:50:18PM +0300, Claudiu Beznea wrote:
> Use devm_of_iomap() to map resources. This will avoid the necessity to
> track the mapped resources and free them on failure path or on remove.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Suggested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---

Thanks, queued.

-- Sebastian

> Changes in v2:
> - use devm_of_iomap()
> - change commit description and title to match to the new approach
> - add Suggested-by tag
> 
>  drivers/power/reset/at91-reset.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
> index 3ff9d93a5226..026649409135 100644
> --- a/drivers/power/reset/at91-reset.c
> +++ b/drivers/power/reset/at91-reset.c
> @@ -192,7 +192,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
>  	if (!reset)
>  		return -ENOMEM;
>  
> -	reset->rstc_base = of_iomap(pdev->dev.of_node, 0);
> +	reset->rstc_base = devm_of_iomap(&pdev->dev, pdev->dev.of_node, 0, NULL);
>  	if (!reset->rstc_base) {
>  		dev_err(&pdev->dev, "Could not map reset controller address\n");
>  		return -ENODEV;
> @@ -202,7 +202,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
>  		/* we need to shutdown the ddr controller, so get ramc base */
>  		for_each_matching_node_and_match(np, at91_ramc_of_match, &match) {
>  			reset->ramc_lpr = (u32)match->data;
> -			reset->ramc_base[idx] = of_iomap(np, 0);
> +			reset->ramc_base[idx] = devm_of_iomap(&pdev->dev, np, 0, NULL);
>  			if (!reset->ramc_base[idx]) {
>  				dev_err(&pdev->dev, "Could not map ram controller address\n");
>  				of_node_put(np);
> -- 
> 2.25.1
> 

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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-04-02 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 10:50 [PATCH v2 1/1] power: reset: at91-reset: use devm_of_iomap Claudiu Beznea
2021-04-02 11:13 ` Sebastian Reichel

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).