All of lore.kernel.org
 help / color / mirror / Atom feed
From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: <linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linus.walleij@linaro.org>, <p.zabel@pengutronix.de>
Subject: Re: [PATCH -next 1/2] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe()
Date: Fri, 16 Sep 2022 21:01:14 +0200	[thread overview]
Message-ID: <20220916190114.nnzc54nvv76jbd7k@soft-dev3-1.localhost> (raw)
In-Reply-To: <20220915151438.699763-1-yangyingliang@huawei.com>

The 09/15/2022 23:14, Yang Yingliang wrote:

Hi Yang,

> 
> Add the missing destroy_workqueue() before return from ocelot_pinctrl_probe()
> in error path.
> 
> Fixes: c297561bc98a ("pinctrl: ocelot: Fix interrupt controller")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/pinctrl/pinctrl-ocelot.c | 25 +++++++++++++++++--------
>  1 file changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c
> index d9c0184c077f..83703a3d291c 100644
> --- a/drivers/pinctrl/pinctrl-ocelot.c
> +++ b/drivers/pinctrl/pinctrl-ocelot.c
> @@ -2072,15 +2072,19 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
>         info->pincfg_data = &data->pincfg_data;
> 
>         reset = devm_reset_control_get_optional_shared(dev, "switch");
> -       if (IS_ERR(reset))
> -               return dev_err_probe(dev, PTR_ERR(reset),
> -                                    "Failed to get reset\n");
> +       if (IS_ERR(reset)) {
> +               ret = dev_err_probe(dev, PTR_ERR(reset),
> +                                   "Failed to get reset\n");
> +               goto err_out;
> +       }
>         reset_control_reset(reset);
> 
>         base = devm_ioremap_resource(dev,
>                         platform_get_resource(pdev, IORESOURCE_MEM, 0));
> -       if (IS_ERR(base))
> -               return PTR_ERR(base);
> +       if (IS_ERR(base)) {
> +               ret = PTR_ERR(base);
> +               goto err_out;
> +       }
> 
>         info->stride = 1 + (info->desc->npins - 1) / 32;
> 
> @@ -2089,7 +2093,8 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
>         info->map = devm_regmap_init_mmio(dev, base, &regmap_config);
>         if (IS_ERR(info->map)) {
>                 dev_err(dev, "Failed to create regmap\n");
> -               return PTR_ERR(info->map);
> +               ret = PTR_ERR(info->map);
> +               goto err_out;
>         }
>         dev_set_drvdata(dev, info);
>         info->dev = dev;
> @@ -2105,15 +2110,19 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
> 
>         ret = ocelot_pinctrl_register(pdev, info);
>         if (ret)
> -               return ret;
> +               goto err_out;

Wouldn't be better actually to add the allocation of the workqueue here?
In this way, you will not need all the previous changes.

> 
>         ret = ocelot_gpiochip_register(pdev, info);
>         if (ret)
> -               return ret;
> +               goto err_out;
> 
>         dev_info(dev, "driver registered\n");
> 
>         return 0;
> +
> +err_out:
> +       destroy_workqueue(info->wq);
> +       return ret;
>  }
> 
>  static int ocelot_pinctrl_remove(struct platform_device *pdev)
> --
> 2.25.1
> 

-- 
/Horatiu

  parent reply	other threads:[~2022-09-16 18:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 15:14 [PATCH -next 1/2] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe() Yang Yingliang
2022-09-15 15:14 ` [PATCH -next 2/2] pinctrl: ocelot: Use devm_platform_get_and_ioremap_resource() Yang Yingliang
2022-09-16 19:01 ` Horatiu Vultur [this message]
2022-09-17  2:28   ` [PATCH -next 1/2] pinctrl: ocelot: add missing destroy_workqueue() in error path in ocelot_pinctrl_probe() Yang Yingliang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220916190114.nnzc54nvv76jbd7k@soft-dev3-1.localhost \
    --to=horatiu.vultur@microchip.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.