Skip to contentSkip to conversation

ion: hisilicon: check the right value after ion_heap_create

PATCH In review Yisheng Xie 3 participants 4 messages May 4, 2017 – May 5, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ion: hisilicon: check the right value after ion_heap_create

From: Yisheng Xie <[email protected]>

It should check ipdev->heaps[i] whether it is error or null instead of ipdev->heaps, after ion_heap_create() for ipdev->heaps[i].

---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +1 -1
index 0de7897..7f8eda5 100644
@@ -66,7 +66,7 @@ static int hi6220_ion_probe(struct platform_device *pdev)
 
 	for (i = 0; i < ipdev->data->nr; i++) {
 		ipdev->heaps[i] = ion_heap_create(&ipdev->data->heaps[i]);
-		if (!ipdev->heaps) {
+		if (IS_ERR_OR_NULL(ipdev->heaps[i])) {
 			ion_destroy_platform_data(ipdev->data);
 			return -ENOMEM;
 		}
Signature · 1 line
1.9.1
#1 lore raw
Quoted 16 lines · Yisheng Xie

From: Yisheng Xie <[email protected]>

It should check ipdev->heaps[i] whether it is error or null instead of ipdev->heaps, after ion_heap_create() for ipdev->heaps[i].

---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +0 -0
index 0de7897..7f8eda5 100644

drivers/staging/android/ion/hisilicon/hi6220_ion.c static int hi6220_ion_probe(struct platform_device *pdev) · line 72

Quoted 8 lines
drivers/staging/android/ion/hisilicon/hi6220_ion.c +1 -1
@@ -66,7 +66,7 @@ static int hi6220_ion_probe(struct platform_device *pdev)
 
 	for (i = 0; i < ipdev->data->nr; i++) {
 		ipdev->heaps[i] = ion_heap_create(&ipdev->data->heaps[i]);
-		if (!ipdev->heaps) {
+		if (IS_ERR_OR_NULL(ipdev->heaps[i])) {
 			ion_destroy_platform_data(ipdev->data);
 			return -ENOMEM;
 		}

This file was removed in a recent clean up series.

Thanks,
Laura

#2 lore raw

Hi Laura,

Quoted 17 lines · Laura Abbott
Quoted 16 lines · Yisheng Xie

From: Yisheng Xie <[email protected]>

It should check ipdev->heaps[i] whether it is error or null instead of ipdev->heaps, after ion_heap_create() for ipdev->heaps[i].

---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +0 -0
index 0de7897..7f8eda5 100644
@@ -66,7 +66,7 @@ static int hi6220_ion_probe(struct platform_device *pdev)
 
Quoted 10 lines

drivers/staging/android/ion/hisilicon/hi6220_ion.c static int hi6220_ion_probe(struct platform_device *pdev) · line 72

Quoted 8 lines
drivers/staging/android/ion/hisilicon/hi6220_ion.c +1 -1
 	for (i = 0; i < ipdev->data->nr; i++) {
 		ipdev->heaps[i] = ion_heap_create(&ipdev->data->heaps[i]);
-		if (!ipdev->heaps) {
+		if (IS_ERR_OR_NULL(ipdev->heaps[i])) {
 			ion_destroy_platform_data(ipdev->data);
 			return -ENOMEM;
 		}

This file was removed in a recent clean up series.

I see, but maybe you should clean up more totally, I mean you should also remove ./drivers/staging/android/ion/devicetree.txt for it is also useless.

Thanks
Yisheng Xie

#3 lore raw
Quoted 30 lines · Yisheng Xie

Hi Laura,

Quoted 17 lines · Laura Abbott
Quoted 16 lines · Yisheng Xie

From: Yisheng Xie <[email protected]>

It should check ipdev->heaps[i] whether it is error or null instead of ipdev->heaps, after ion_heap_create() for ipdev->heaps[i].

---
 drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/ion/hisilicon/hi6220_ion.c +0 -0
index 0de7897..7f8eda5 100644
@@ -66,7 +66,7 @@ static int hi6220_ion_probe(struct platform_device *pdev)
 
Quoted 10 lines

drivers/staging/android/ion/hisilicon/hi6220_ion.c static int hi6220_ion_probe(struct platform_device *pdev) · line 72

Quoted 8 lines
drivers/staging/android/ion/hisilicon/hi6220_ion.c +1 -1
 	for (i = 0; i < ipdev->data->nr; i++) {
 		ipdev->heaps[i] = ion_heap_create(&ipdev->data->heaps[i]);
-		if (!ipdev->heaps) {
+		if (IS_ERR_OR_NULL(ipdev->heaps[i])) {
 			ion_destroy_platform_data(ipdev->data);
 			return -ENOMEM;
 		}

This file was removed in a recent clean up series.

Quoted 6 lines

I see, but maybe you should clean up more totally, I mean you should also remove ./drivers/staging/android/ion/devicetree.txt for it is also useless.

Thanks
Yisheng Xie

Thanks for letting me know. Feel free to submit a patch to remove it.

Thanks,
Laura