2020-12-04 08:04:07

by Zhang Changzhong

[permalink] [raw]
Subject: [PATCH] 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")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Zhang Changzhong <[email protected]>
---
drivers/bus/fsl-mc/fsl-mc-allocator.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c
index e71a6f5..2d7c764 100644
--- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
+++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
@@ -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,
--
2.9.5


2020-12-04 10:47:14

by Laurentiu Tudor

[permalink] [raw]
Subject: Re: [PATCH] bus: fsl-mc: fix error return code in fsl_mc_object_allocate()



On 12/4/2020 10:02 AM, Zhang Changzhong wrote:
> 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")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Zhang Changzhong <[email protected]>

Acked-by: Laurentiu Tudor <[email protected]>

---
Best Regards, Laurentiu

> ---
> drivers/bus/fsl-mc/fsl-mc-allocator.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c
> index e71a6f5..2d7c764 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
> @@ -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,
>