Re: [PATCH 4.19 353/422] slimbus: ngd: return proper error code instead of zero

From: Pavel Machek
Date: Wed Nov 20 2019 - 07:36:08 EST


On Tue 2019-11-19 06:19:10, Greg Kroah-Hartman wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
>
> [ Upstream commit 9652e6aa62a1836494ebb8dbd402587c083b568c ]
>
> It looks like there is a typo in probe return. Fix it.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
> drivers/slimbus/qcom-ngd-ctrl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
> index a9abde2f4088b..e587be9064e74 100644
> --- a/drivers/slimbus/qcom-ngd-ctrl.c
> +++ b/drivers/slimbus/qcom-ngd-ctrl.c
> @@ -1393,7 +1393,7 @@ wq_err:
> if (ctrl->mwq)
> destroy_workqueue(ctrl->mwq);
>
> - return 0;
> + return ret;
> }

The code makes no sense, even after the fix. Only way to enter wq_err
is with via if !ctrl->mwq... but it proceeds to test it for zero.

IOW... this.

Signed-off-by: Pavel Machek <pavel@xxxxxxx>

diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index d72f8eed2e8b..5a327d45dc2d 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1385,17 +1385,11 @@ static int qcom_slim_ngd_probe(struct platform_device *pdev)
ctrl->mwq = create_singlethread_workqueue("ngd_master");
if (!ctrl->mwq) {
dev_err(&pdev->dev, "Failed to start master worker\n");
- ret = -ENOMEM;
- goto wq_err;
+ qcom_slim_ngd_qmi_svc_event_deinit(&ctrl->qmi);
+ return -ENOMEM;
}

return 0;
-wq_err:
- qcom_slim_ngd_qmi_svc_event_deinit(&ctrl->qmi);
- if (ctrl->mwq)
- destroy_workqueue(ctrl->mwq);
-
- return ret;
}

static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)


--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature