[PATCH -next] slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register
Neil Armstrong
neil.armstrong at linaro.org
Tue Sep 20 15:32:03 CEST 2022
On 14/09/2022 05:19, Lin Yujun wrote:
> No error handling is performed when platform_device_add()
> return fails. Refer to the error handling of driver_set_override(),
> add error handling for platform_device_add().
>
> Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
> Signed-off-by: Lin Yujun <linyujun809 at huawei.com>
> ---
> drivers/slimbus/qcom-ngd-ctrl.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
> index 0aa8408464ad..fb591990ddad 100644
> --- a/drivers/slimbus/qcom-ngd-ctrl.c
> +++ b/drivers/slimbus/qcom-ngd-ctrl.c
> @@ -1470,7 +1470,13 @@ static int of_qcom_slim_ngd_register(struct device *parent,
> ngd->pdev->dev.of_node = node;
> ctrl->ngd = ngd;
>
> - platform_device_add(ngd->pdev);
> + ret = platform_device_add(ngd->pdev);
> + if (ret) {
> + platform_device_put(ngd->pdev);
> + kfree(ngd);
> + of_node_put(node);
> + return ret;
> + }
> ngd->base = ctrl->base + ngd->id * data->offset +
> (ngd->id - 1) * data->size;
>
Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
More information about the Alsa-devel
mailing list