From: Sam Protsenko <semen.protsenko@linaro.org> To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Cc: Tomasz Figa <tomasz.figa@gmail.com>, Sylwester Nawrocki <s.nawrocki@samsung.com>, Linus Walleij <linus.walleij@linaro.org>, Rob Herring <robh+dt@kernel.org>, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Szyprowski <m.szyprowski@samsung.com>, Sylwester Nawrocki <snawrocki@kernel.org>, Chanho Park <chanho61.park@samsung.com>, stable@vger.kernel.org Subject: Re: [PATCH 01/24] pinctrl: samsung: drop pin banks references on error paths Date: Mon, 3 Jan 2022 16:49:08 +0200 [thread overview] Message-ID: <CAPLW+4mosbk2_NPFFP=sUmKjBoZOG3vNcmT+7sMtTunhbVqcxA@mail.gmail.com> (raw) In-Reply-To: <20211231161930.256733-2-krzysztof.kozlowski@canonical.com> On Fri, 31 Dec 2021 at 18:20, Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> wrote: > > The driver iterates over its devicetree children with > for_each_child_of_node() and stores for later found node pointer. This > has to be put in error paths to avoid leak during re-probing. > > Fixes: ab663789d697 ("pinctrl: samsung: Match pin banks with their device nodes") > Cc: <stable@vger.kernel.org> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > --- > drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++------ > 1 file changed, 22 insertions(+), 7 deletions(-) > > diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c > index 8941f658e7f1..f2864a7869b3 100644 > --- a/drivers/pinctrl/samsung/pinctrl-samsung.c > +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c > @@ -1002,6 +1002,15 @@ samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev) > return &(of_data->ctrl[id]); > } > > +static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d) > +{ > + struct samsung_pin_bank *bank; > + unsigned int i; > + > + for (i = 0; i < d->nr_banks; ++i, ++bank) > + of_node_put(bank->of_node); But "bank" variable wasn't actually assigned before, only declared? > +} > + > /* retrieve the soc specific data */ > static const struct samsung_pin_ctrl * > samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, > @@ -1116,19 +1125,19 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) > if (ctrl->retention_data) { > drvdata->retention_ctrl = ctrl->retention_data->init(drvdata, > ctrl->retention_data); > - if (IS_ERR(drvdata->retention_ctrl)) > - return PTR_ERR(drvdata->retention_ctrl); > + if (IS_ERR(drvdata->retention_ctrl)) { > + ret = PTR_ERR(drvdata->retention_ctrl); > + goto err_put_banks; > + } > } > > ret = samsung_pinctrl_register(pdev, drvdata); > if (ret) > - return ret; > + goto err_put_banks; > > ret = samsung_gpiolib_register(pdev, drvdata); > - if (ret) { > - samsung_pinctrl_unregister(pdev, drvdata); > - return ret; > - } > + if (ret) > + goto err_unregister; > > if (ctrl->eint_gpio_init) > ctrl->eint_gpio_init(drvdata); > @@ -1138,6 +1147,12 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, drvdata); > > return 0; > + > +err_unregister: > + samsung_pinctrl_unregister(pdev, drvdata); > +err_put_banks: > + samsung_banks_of_node_put(drvdata); > + return ret; > } > > /* > -- > 2.32.0 >
WARNING: multiple messages have this Message-ID (diff)
From: Sam Protsenko <semen.protsenko@linaro.org> To: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Cc: Tomasz Figa <tomasz.figa@gmail.com>, Sylwester Nawrocki <s.nawrocki@samsung.com>, Linus Walleij <linus.walleij@linaro.org>, Rob Herring <robh+dt@kernel.org>, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Szyprowski <m.szyprowski@samsung.com>, Sylwester Nawrocki <snawrocki@kernel.org>, Chanho Park <chanho61.park@samsung.com>, stable@vger.kernel.org Subject: Re: [PATCH 01/24] pinctrl: samsung: drop pin banks references on error paths Date: Mon, 3 Jan 2022 16:49:08 +0200 [thread overview] Message-ID: <CAPLW+4mosbk2_NPFFP=sUmKjBoZOG3vNcmT+7sMtTunhbVqcxA@mail.gmail.com> (raw) In-Reply-To: <20211231161930.256733-2-krzysztof.kozlowski@canonical.com> On Fri, 31 Dec 2021 at 18:20, Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> wrote: > > The driver iterates over its devicetree children with > for_each_child_of_node() and stores for later found node pointer. This > has to be put in error paths to avoid leak during re-probing. > > Fixes: ab663789d697 ("pinctrl: samsung: Match pin banks with their device nodes") > Cc: <stable@vger.kernel.org> > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > --- > drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++------ > 1 file changed, 22 insertions(+), 7 deletions(-) > > diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c > index 8941f658e7f1..f2864a7869b3 100644 > --- a/drivers/pinctrl/samsung/pinctrl-samsung.c > +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c > @@ -1002,6 +1002,15 @@ samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev) > return &(of_data->ctrl[id]); > } > > +static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d) > +{ > + struct samsung_pin_bank *bank; > + unsigned int i; > + > + for (i = 0; i < d->nr_banks; ++i, ++bank) > + of_node_put(bank->of_node); But "bank" variable wasn't actually assigned before, only declared? > +} > + > /* retrieve the soc specific data */ > static const struct samsung_pin_ctrl * > samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d, > @@ -1116,19 +1125,19 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) > if (ctrl->retention_data) { > drvdata->retention_ctrl = ctrl->retention_data->init(drvdata, > ctrl->retention_data); > - if (IS_ERR(drvdata->retention_ctrl)) > - return PTR_ERR(drvdata->retention_ctrl); > + if (IS_ERR(drvdata->retention_ctrl)) { > + ret = PTR_ERR(drvdata->retention_ctrl); > + goto err_put_banks; > + } > } > > ret = samsung_pinctrl_register(pdev, drvdata); > if (ret) > - return ret; > + goto err_put_banks; > > ret = samsung_gpiolib_register(pdev, drvdata); > - if (ret) { > - samsung_pinctrl_unregister(pdev, drvdata); > - return ret; > - } > + if (ret) > + goto err_unregister; > > if (ctrl->eint_gpio_init) > ctrl->eint_gpio_init(drvdata); > @@ -1138,6 +1147,12 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, drvdata); > > return 0; > + > +err_unregister: > + samsung_pinctrl_unregister(pdev, drvdata); > +err_put_banks: > + samsung_banks_of_node_put(drvdata); > + return ret; > } > > /* > -- > 2.32.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-03 14:49 UTC|newest] Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-31 16:19 [PATCH 00/24] pinctrl: dt-bindings: samsung: convert to dtschema Krzysztof Kozlowski 2021-12-31 16:19 ` Krzysztof Kozlowski 2021-12-31 16:19 ` [PATCH 01/24] pinctrl: samsung: drop pin banks references on error paths Krzysztof Kozlowski 2021-12-31 16:19 ` Krzysztof Kozlowski 2022-01-03 14:49 ` Sam Protsenko [this message] 2022-01-03 14:49 ` Sam Protsenko 2022-01-05 20:24 ` Krzysztof Kozlowski 2022-01-05 20:24 ` Krzysztof Kozlowski 2021-12-31 16:19 ` [PATCH 02/24] pinctrl: samsung: accept GPIO bank nodes with a suffix Krzysztof Kozlowski 2021-12-31 16:19 ` Krzysztof Kozlowski 2022-01-03 18:43 ` Sam Protsenko 2022-01-03 18:43 ` Sam Protsenko 2022-01-05 20:31 ` Krzysztof Kozlowski 2022-01-05 20:31 ` Krzysztof Kozlowski 2021-12-31 16:19 ` [PATCH 03/24] ARM: dts: exynos: drop unused pinctrl defines in Exynos3250 Krzysztof Kozlowski 2021-12-31 16:19 ` Krzysztof Kozlowski 2022-01-06 18:20 ` Alim Akhtar 2022-01-06 18:20 ` Alim Akhtar 2021-12-31 16:19 ` [PATCH 04/24] ARM: dts: exynos: simplify PMIC DVS pin configuration in Odroid XU Krzysztof Kozlowski 2021-12-31 16:19 ` Krzysztof Kozlowski 2021-12-31 16:19 ` [PATCH 05/24] ARM: dts: exynos: override pins by label in Peach Pit Krzysztof Kozlowski 2021-12-31 16:19 ` Krzysztof Kozlowski 2022-01-06 18:42 ` Alim Akhtar 2022-01-06 18:42 ` Alim Akhtar 2021-12-31 16:19 ` [PATCH 06/24] ARM: dts: exynos: simplify PMIC DVS pin configuration " Krzysztof Kozlowski 2021-12-31 16:19 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 07/24] ARM: dts: exynos: override pins by label in Peach Pi Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2022-01-06 18:44 ` Alim Akhtar 2022-01-06 18:44 ` Alim Akhtar 2021-12-31 16:21 ` [PATCH 08/24] ARM: dts: exynos: simplify PMIC DVS pin configuration " Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2022-01-06 18:47 ` Alim Akhtar 2022-01-06 18:47 ` Alim Akhtar 2022-01-07 7:34 ` Krzysztof Kozlowski 2022-01-07 7:34 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 09/24] ARM: dts: s3c64xx: drop unneeded pinctrl wake-up interrupt mapping Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 10/24] ARM: dts: exynos: align pinctrl with dtschema in Exynos3250 Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 11/24] ARM: dts: exynos: align pinctrl with dtschema in Exynos4210 Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 12/24] ARM: dts: exynos: align pinctrl with dtschema in Exynos4412 Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 13/24] ARM: dts: exynos: align pinctrl with dtschema in Exynos5250 Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 14/24] ARM: dts: exynos: align pinctrl with dtschema in Exynos5260 Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 15/24] ARM: dts: exynos: align pinctrl with dtschema in Exynos5410 Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2021-12-31 16:21 ` [PATCH 16/24] ARM: dts: exynos: align pinctrl with dtschema in Exynos542x/5800 Krzysztof Kozlowski 2021-12-31 16:21 ` Krzysztof Kozlowski 2021-12-31 16:22 ` [PATCH 17/24] arm64: dts: exynos: align pinctrl with dtschema in Exynos5433 Krzysztof Kozlowski 2021-12-31 16:22 ` Krzysztof Kozlowski 2021-12-31 16:23 ` [PATCH 18/24] arm64: dts: exynos: align pinctrl with dtschema in Exynos7 Krzysztof Kozlowski 2021-12-31 16:23 ` Krzysztof Kozlowski 2021-12-31 16:23 ` [PATCH 19/24] arm64: dts: exynos: align pinctrl with dtschema in Exynos850 Krzysztof Kozlowski 2021-12-31 16:23 ` Krzysztof Kozlowski 2022-01-03 14:45 ` Sam Protsenko 2022-01-03 14:45 ` Sam Protsenko 2021-12-31 16:23 ` [PATCH 20/24] arm64: dts: exynos: align pinctrl with dtschema in ExynosAutov9 Krzysztof Kozlowski 2021-12-31 16:23 ` Krzysztof Kozlowski 2021-12-31 16:23 ` [PATCH 21/24] ARM: dts: s3c24xx: align pinctrl with dtschema Krzysztof Kozlowski 2021-12-31 16:23 ` Krzysztof Kozlowski 2021-12-31 16:23 ` [PATCH 22/24] ARM: dts: s3c64xx: " Krzysztof Kozlowski 2021-12-31 16:23 ` Krzysztof Kozlowski 2021-12-31 16:23 ` [PATCH 23/24] ARM: dts: s5pv210: " Krzysztof Kozlowski 2021-12-31 16:23 ` Krzysztof Kozlowski 2021-12-31 16:23 ` [PATCH 24/24] dt-bindings: pinctrl: samsung: convert to dtschema Krzysztof Kozlowski 2021-12-31 16:23 ` Krzysztof Kozlowski 2022-01-03 21:19 ` Sam Protsenko 2022-01-03 21:19 ` Sam Protsenko 2022-01-10 20:43 ` Rob Herring 2022-01-10 20:43 ` Rob Herring
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='CAPLW+4mosbk2_NPFFP=sUmKjBoZOG3vNcmT+7sMtTunhbVqcxA@mail.gmail.com' \ --to=semen.protsenko@linaro.org \ --cc=chanho61.park@samsung.com \ --cc=devicetree@vger.kernel.org \ --cc=krzysztof.kozlowski@canonical.com \ --cc=linus.walleij@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-gpio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=m.szyprowski@samsung.com \ --cc=robh+dt@kernel.org \ --cc=s.nawrocki@samsung.com \ --cc=snawrocki@kernel.org \ --cc=stable@vger.kernel.org \ --cc=tomasz.figa@gmail.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: linkBe 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.