Skip to contentSkip to conversation

bus: fsl-mc: fix error return code in fsl_mc_object_allocate()

PATCH In review Zhang Changzhong 2 participants 2 messages Dec 4, 2020 QorIQ DPAA2 fsl-mc bus driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus: fsl-mc: fix error return code in fsl_mc_object_allocate()

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 197f4d6a4a00 ("staging: fsl-mc: fsl-mc object allocator driver")
---
 drivers/bus/fsl-mc/fsl-mc-allocator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/fsl-mc/fsl-mc-allocator.c +3 -1
index e71a6f5..2d7c764 100644
@@ -292,8 +292,10 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev,
 		goto error;
 
 	mc_adev = resource->data;
-	if (!mc_adev)
+	if (!mc_adev) {
+		error = -EINVAL;
 		goto error;
+	}
 
 	mc_adev->consumer_link = device_link_add(&mc_dev->dev,
 						 &mc_adev->dev,
Signature · 1 line
2.9.5
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Zhang Changzhong

Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.

Fixes 197f4d6a4a00 ("staging: fsl-mc: fsl-mc object allocator driver")

---
Best Regards, Laurentiu

Quoted 21 lines
---
 drivers/bus/fsl-mc/fsl-mc-allocator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/fsl-mc/fsl-mc-allocator.c +3 -1
index e71a6f5..2d7c764 100644
@@ -292,8 +292,10 @@ int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev,
 		goto error;
 
 	mc_adev = resource->data;
-	if (!mc_adev)
+	if (!mc_adev) {
+		error = -EINVAL;
 		goto error;
+	}
 
 	mc_adev->consumer_link = device_link_add(&mc_dev->dev,
 						 &mc_adev->dev,