Skip to contentSkip to conversation

staging: android: ion: Fix return value check in hi6220_ion_probe()

PATCH In review Wei Yongjun 3 participants 3 messages Sep 15, 2016 – Sep 16, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: android: ion: Fix return value check in hi6220_ion_probe()

From: Wei Yongjun <[email protected]>

In case of error, the function ion_device_create() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +2 -2
index f392db2..659aa71 100644
@@ -49,8 +49,8 @@ static int hi6220_ion_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, ipdev);
 
 	ipdev->idev = ion_device_create(NULL);
-	if (!ipdev->idev)
-		return -ENOMEM;
+	if (IS_ERR(ipdev->idev))
+		return PTR_ERR(ipdev->idev);
 
 	ipdev->data = ion_parse_dt(pdev, hisi_heaps);
 	if (IS_ERR(ipdev->data))
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

In case of error, the function ion_device_create() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Quoted 23 lines
---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +2 -2
index f392db2..659aa71 100644
@@ -49,8 +49,8 @@ static int hi6220_ion_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, ipdev);
 
 	ipdev->idev = ion_device_create(NULL);
-	if (!ipdev->idev)
-		return -ENOMEM;
+	if (IS_ERR(ipdev->idev))
+		return PTR_ERR(ipdev->idev);
 
 	ipdev->data = ion_parse_dt(pdev, hisi_heaps);
 	if (IS_ERR(ipdev->data))
Reviewed-by
#2 lore raw
Quoted 11 lines · Laura Abbott
Quoted 7 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

In case of error, the function ion_device_create() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().

Quoted 27 lines
Quoted 26 lines
---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +2 -2
index f392db2..659aa71 100644
@@ -49,8 +49,8 @@ static int hi6220_ion_probe(struct platform_device
 *pdev)
        platform_set_drvdata(pdev, ipdev);
 
        ipdev->idev = ion_device_create(NULL);
-       if (!ipdev->idev)
-               return -ENOMEM;
+       if (IS_ERR(ipdev->idev))
+               return PTR_ERR(ipdev->idev);
 
        ipdev->data = ion_parse_dt(pdev, hisi_heaps);
        if (IS_ERR(ipdev->data))
Signature · 5 lines
Thanks and regards,

Sumit Semwal
Linaro Mobile Group - Kernel Team Lead
Linaro.org │ Open source software for ARM SoCs