mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res
@ 2024-08-26 12:59 Jinjie Ruan
  2024-08-26 12:59 ` [PATCH -next 1/2] " Jinjie Ruan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jinjie Ruan @ 2024-08-26 12:59 UTC (permalink / raw)
  To: broonie, nicolas.ferre, alexandre.belloni, claudiu.beznea,
	linux-spi, linux-arm-kernel, linux-kernel
  Cc: ruanjinjie

Fix uninitialized res in probe function.

Jinjie Ruan (2):
  spi: atmel-quadspi: Fix uninitialized res
  spi: atmel-quadspi: Simplify with dev_err_probe()

 drivers/spi/atmel-quadspi.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

-- 
2.34.1


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

* [PATCH -next 1/2] spi: atmel-quadspi: Fix uninitialized res
  2024-08-26 12:59 [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res Jinjie Ruan
@ 2024-08-26 12:59 ` Jinjie Ruan
  2024-08-27  6:01   ` Hari.PrasathGE
  2024-08-26 12:59 ` [PATCH -next 2/2] spi: atmel-quadspi: Simplify with dev_err_probe() Jinjie Ruan
  2024-08-30 13:26 ` [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Jinjie Ruan @ 2024-08-26 12:59 UTC (permalink / raw)
  To: broonie, nicolas.ferre, alexandre.belloni, claudiu.beznea,
	linux-spi, linux-arm-kernel, linux-kernel
  Cc: ruanjinjie

The second platform_get_resource_byname() can not be replaced with
devm_platform_ioremap_resource_byname(), because the intermediate "res"
is used to assign for "aq->mmap_size".

Fixes: 3ccea1dedef3 ("spi: atmel-quadspi: Simpify resource lookup")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/spi/atmel-quadspi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index 2b5c72176711..56dd8dcb86cb 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -608,7 +608,8 @@ static int atmel_qspi_probe(struct platform_device *pdev)
 	}
 
 	/* Map the AHB memory */
-	aq->mem = devm_platform_ioremap_resource_byname(pdev, "qspi_mmap");
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mmap");
+	aq->mem = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(aq->mem)) {
 		dev_err(&pdev->dev, "missing AHB memory\n");
 		return PTR_ERR(aq->mem);
-- 
2.34.1


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

* [PATCH -next 2/2] spi: atmel-quadspi: Simplify with dev_err_probe()
  2024-08-26 12:59 [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res Jinjie Ruan
  2024-08-26 12:59 ` [PATCH -next 1/2] " Jinjie Ruan
@ 2024-08-26 12:59 ` Jinjie Ruan
  2024-08-30 13:26 ` [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Jinjie Ruan @ 2024-08-26 12:59 UTC (permalink / raw)
  To: broonie, nicolas.ferre, alexandre.belloni, claudiu.beznea,
	linux-spi, linux-arm-kernel, linux-kernel
  Cc: ruanjinjie

Use the dev_err_probe() helper to simplify error handling during probe.
This also handle scenario, when EDEFER is returned and useless error
is printed.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/spi/atmel-quadspi.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index 56dd8dcb86cb..936d57869493 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -602,18 +602,16 @@ static int atmel_qspi_probe(struct platform_device *pdev)
 
 	/* Map the registers */
 	aq->regs = devm_platform_ioremap_resource_byname(pdev, "qspi_base");
-	if (IS_ERR(aq->regs)) {
-		dev_err(&pdev->dev, "missing registers\n");
-		return PTR_ERR(aq->regs);
-	}
+	if (IS_ERR(aq->regs))
+		return dev_err_probe(&pdev->dev, PTR_ERR(aq->regs),
+				     "missing registers\n");
 
 	/* Map the AHB memory */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mmap");
 	aq->mem = devm_ioremap_resource(&pdev->dev, res);
-	if (IS_ERR(aq->mem)) {
-		dev_err(&pdev->dev, "missing AHB memory\n");
-		return PTR_ERR(aq->mem);
-	}
+	if (IS_ERR(aq->mem))
+		return dev_err_probe(&pdev->dev, PTR_ERR(aq->mem),
+				     "missing AHB memory\n");
 
 	aq->mmap_size = resource_size(res);
 
@@ -622,17 +620,15 @@ static int atmel_qspi_probe(struct platform_device *pdev)
 	if (IS_ERR(aq->pclk))
 		aq->pclk = devm_clk_get(&pdev->dev, NULL);
 
-	if (IS_ERR(aq->pclk)) {
-		dev_err(&pdev->dev, "missing peripheral clock\n");
-		return PTR_ERR(aq->pclk);
-	}
+	if (IS_ERR(aq->pclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(aq->pclk),
+				     "missing peripheral clock\n");
 
 	/* Enable the peripheral clock */
 	err = clk_prepare_enable(aq->pclk);
-	if (err) {
-		dev_err(&pdev->dev, "failed to enable the peripheral clock\n");
-		return err;
-	}
+	if (err)
+		return dev_err_probe(&pdev->dev, err,
+				     "failed to enable the peripheral clock\n");
 
 	aq->caps = of_device_get_match_data(&pdev->dev);
 	if (!aq->caps) {
-- 
2.34.1


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

* Re: [PATCH -next 1/2] spi: atmel-quadspi: Fix uninitialized res
  2024-08-26 12:59 ` [PATCH -next 1/2] " Jinjie Ruan
@ 2024-08-27  6:01   ` Hari.PrasathGE
  0 siblings, 0 replies; 5+ messages in thread
From: Hari.PrasathGE @ 2024-08-27  6:01 UTC (permalink / raw)
  To: ruanjinjie, broonie, Nicolas.Ferre, alexandre.belloni,
	claudiu.beznea, linux-spi, linux-arm-kernel, linux-kernel

Hello,

On 8/26/24 6:29 PM, Jinjie Ruan wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The second platform_get_resource_byname() can not be replaced with
> devm_platform_ioremap_resource_byname(), because the intermediate "res"
> is used to assign for "aq->mmap_size".
> 

Yes indeed.

I see that the above commit is merged in the SPI git tree. With that,

Acked-by: Hari Prasath Gujulan Elango <hari.prasathge@microchip.com>

Regards,
Hari

> Fixes: 3ccea1dedef3 ("spi: atmel-quadspi: Simpify resource lookup")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>   drivers/spi/atmel-quadspi.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
> index 2b5c72176711..56dd8dcb86cb 100644
> --- a/drivers/spi/atmel-quadspi.c
> +++ b/drivers/spi/atmel-quadspi.c
> @@ -608,7 +608,8 @@ static int atmel_qspi_probe(struct platform_device *pdev)
>          }
> 
>          /* Map the AHB memory */
> -       aq->mem = devm_platform_ioremap_resource_byname(pdev, "qspi_mmap");
> +       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mmap");
> +       aq->mem = devm_ioremap_resource(&pdev->dev, res);
>          if (IS_ERR(aq->mem)) {
>                  dev_err(&pdev->dev, "missing AHB memory\n");
>                  return PTR_ERR(aq->mem);
> --
> 2.34.1
> 
> 

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

* Re: [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res
  2024-08-26 12:59 [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res Jinjie Ruan
  2024-08-26 12:59 ` [PATCH -next 1/2] " Jinjie Ruan
  2024-08-26 12:59 ` [PATCH -next 2/2] spi: atmel-quadspi: Simplify with dev_err_probe() Jinjie Ruan
@ 2024-08-30 13:26 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2024-08-30 13:26 UTC (permalink / raw)
  To: nicolas.ferre, alexandre.belloni, claudiu.beznea, linux-spi,
	linux-arm-kernel, linux-kernel, Jinjie Ruan

On Mon, 26 Aug 2024 20:59:11 +0800, Jinjie Ruan wrote:
> Fix uninitialized res in probe function.
> 
> Jinjie Ruan (2):
>   spi: atmel-quadspi: Fix uninitialized res
>   spi: atmel-quadspi: Simplify with dev_err_probe()
> 
> drivers/spi/atmel-quadspi.c | 31 ++++++++++++++-----------------
>  1 file changed, 14 insertions(+), 17 deletions(-)
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] spi: atmel-quadspi: Fix uninitialized res
      commit: 99311b8a9ea2b83413cbb80e17c4648a518e7486
[2/2] spi: atmel-quadspi: Simplify with dev_err_probe()
      commit: 2d3e6351a25de0ceef69aae415cb1e082f0382c7

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2024-08-30 13:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-26 12:59 [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res Jinjie Ruan
2024-08-26 12:59 ` [PATCH -next 1/2] " Jinjie Ruan
2024-08-27  6:01   ` Hari.PrasathGE
2024-08-26 12:59 ` [PATCH -next 2/2] spi: atmel-quadspi: Simplify with dev_err_probe() Jinjie Ruan
2024-08-30 13:26 ` [PATCH -next 0/2] spi: atmel-quadspi: Fix uninitialized res Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®