Skip to contentSkip to conversation

ata: palmld: fix return value check in palmld_pata_probe()

PATCH RESEND Applied Yang Yingliang 2 participants 5 messages Oct 29, 2022 – Nov 2, 2022 libata

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 ata: palmld: fix return value check in palmld_pata_probe()

If devm_platform_ioremap_resource() fails, it never return NULL pointer, replace the check with IS_ERR().

Fixes 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")

---
The previous patch link:
https://lore.kernel.org/lkml/[email protected]/T/#t

---
 drivers/ata/pata_palmld.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/pata_palmld.c +2 -2
index 400e65190904..51caa2a427dd 100644
@@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device *pdev)
 
 	/* remap drive's physical memory address */
 	mem = devm_platform_ioremap_resource(pdev, 0);
-	if (!mem)
-		return -ENOMEM;
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
 
 	/* request and activate power and reset GPIOs */
 	lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 19 lines · Yang Yingliang

If devm_platform_ioremap_resource() fails, it never return NULL pointer, replace the check with IS_ERR().

Fixes 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")

---
The previous patch link:
https://lore.kernel.org/lkml/[email protected]/T/#t

---
 drivers/ata/pata_palmld.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/pata_palmld.c +0 -0
index 400e65190904..51caa2a427dd 100644

drivers/ata/pata_palmld.c static int palmld_pata_probe(struct platform_device *pdev) · line 70

Quoted 10 lines
drivers/ata/pata_palmld.c +2 -2
@@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device *pdev)
 
 	/* remap drive's physical memory address */
 	mem = devm_platform_ioremap_resource(pdev, 0);
-	if (!mem)
-		return -ENOMEM;
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
 
 	/* request and activate power and reset GPIOs */
 	lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);

Arnd has a series of patches that removes this driver from the kernel in 6.2. Do you need this fix for a stable release ?

Signature · 2 lines
Damien Le Moal
Western Digital Research
#2 lore raw

Hi,

Quoted 28 lines · Damien Le Moal
Quoted 27 lines · Yang Yingliang

If devm_platform_ioremap_resource() fails, it never return NULL pointer, replace the check with IS_ERR().

Fixes 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")

---
The previous patch link:
https://lore.kernel.org/lkml/[email protected]/T/#t

---
  drivers/ata/pata_palmld.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/pata_palmld.c +2 -2
index 400e65190904..51caa2a427dd 100644
@@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device *pdev)
 
  	/* remap drive's physical memory address */
  	mem = devm_platform_ioremap_resource(pdev, 0);
-	if (!mem)
-		return -ENOMEM;
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
 
Quoted 4 lines

drivers/ata/pata_palmld.c static int palmld_pata_probe(struct platform_device *pdev) · line 70

Quoted 2 lines
drivers/ata/pata_palmld.c +0 -0
  	/* request and activate power and reset GPIOs */
  	lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);

Arnd has a series of patches that removes this driver from the kernel in 6.2. Do you need this fix for a stable release ?

It's nice that you can merge this patch. If you don't take this, it's not a big problem.

Thanks,
Yang

Quoted 1 line
#3 lore raw
Quoted 34 lines · Yang Yingliang

Hi,

Quoted 15 lines · Damien Le Moal
Quoted 14 lines · Yang Yingliang

If devm_platform_ioremap_resource() fails, it never return NULL pointer, replace the check with IS_ERR().

Fixes 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")

---
The previous patch link:
https://lore.kernel.org/lkml/[email protected]/T/#t
---
  drivers/ata/pata_palmld.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 5 lines
drivers/ata/pata_palmld.c +0 -0
index 400e65190904..51caa2a427dd 100644

drivers/ata/pata_palmld.c static int palmld_pata_probe(struct platform_device · line 69

Quoted 9 lines
drivers/ata/pata_palmld.c +2 -2
@@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device
 *pdev)
         /* remap drive's physical memory address */
       mem = devm_platform_ioremap_resource(pdev, 0);
-    if (!mem)
-        return -ENOMEM;
+    if (IS_ERR(mem))
+        return PTR_ERR(mem);
         /* request and activate power and reset GPIOs */
       lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);

Arnd has a series of patches that removes this driver from the kernel in 6.2. Do you need this fix for a stable release ?

Quoted 2 lines

It's nice that you can merge this patch. If you don't take this, it's not a big problem.

Sorry, I got confused. This is a bug fix, so I will apply it to for-6.1-fixes. I was thinking about 6.2, but the driver will then be gone.

Quoted 4 lines

Thanks,
Yang

Quoted 1 line
Signature · 2 lines
Damien Le Moal
Western Digital Research
#4 lore raw
In reply to Yang Yingliang
Quoted 7 lines · Yang Yingliang

If devm_platform_ioremap_resource() fails, it never return NULL pointer, replace the check with IS_ERR().

Fixes 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")

Applied to for-6.1-fixes. Thanks !

Quoted 22 lines

---
The previous patch link:
https://lore.kernel.org/lkml/[email protected]/T/#t

---
 drivers/ata/pata_palmld.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/pata_palmld.c +2 -2
index 400e65190904..51caa2a427dd 100644
@@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device *pdev)
 
 	/* remap drive's physical memory address */
 	mem = devm_platform_ioremap_resource(pdev, 0);
-	if (!mem)
-		return -ENOMEM;
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
 
 	/* request and activate power and reset GPIOs */
 	lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);
Signature · 2 lines
Damien Le Moal
Western Digital Research