[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c0deb523-0458-5422-bed5-ee104ca7c479@wanadoo.fr>
Date: Thu, 29 Dec 2022 22:43:19 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Aleksandr Burakov <a.burakov@...alinux.ru>
Cc: linux-pci@...r.kernel.org, linux-amlogic@...ts.infradead.org,
linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org,
Yue Wang <yue.wang@...ogic.com>,
Hanjie Lin <hanjie.lin@...ogic.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>,
Krzysztof Wilczyński <kw@...ux.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Kevin Hilman <khilman@...libre.com>,
Jerome Brunet <jbrunet@...libre.com>,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>
Subject: Re: [PATCH] PCI: amlogic: The check for devm_add_action_or_reset's
return value added
Le 20/12/2022 à 10:21, Aleksandr Burakov a écrit :
> The return value of the function devm_add_action_or_reset() was not
> checked hence an error code would not be returned.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 9c0ef6d34fdb ("PCI: amlogic: Add the Amlogic Meson PCIe controller driver")
> Signed-off-by: Aleksandr Burakov <a.burakov@...alinux.ru>
> ---
> drivers/pci/controller/dwc/pci-meson.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c
> index c1527693bed9..3d82f0b65480 100644
> --- a/drivers/pci/controller/dwc/pci-meson.c
> +++ b/drivers/pci/controller/dwc/pci-meson.c
> @@ -187,9 +187,13 @@ static inline struct clk *meson_pcie_probe_clock(struct device *dev,
> return ERR_PTR(ret);
> }
>
> - devm_add_action_or_reset(dev,
> + ret = devm_add_action_or_reset(dev,
> (void (*) (void *))clk_disable_unprepare,
Hi,
using devm_clk_get_enabled() a few lines above would be IMHO much more
elegant than these casts.
This also saves a few LoC and avoid some other warnings/issues. (see [1])
Such an approach has already been used in [2].
Just my 2c,
CJ
[1]: https://lore.kernel.org/all/20221118233101.never.215-kees@kernel.org/
[2]: https://lore.kernel.org/all/20221202184525.gonna.423-kees@kernel.org/
> clk);
> + if (ret) {
> + dev_err(dev, "couldn't reset clk\n");
> + return ERR_PTR(ret);
> + }
>
> return clk;
> }
Powered by blists - more mailing lists