All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksandr Burakov <a.burakov@rosalinux.ru>
To: "Yue Wang" <yue.wang@amlogic.com>,
	"Hanjie Lin" <hanjie.lin@amlogic.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>
Cc: Aleksandr Burakov <a.burakov@rosalinux.ru>,
	linux-pci@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: [PATCH] PCI: amlogic: The check for devm_add_action_or_reset's return value added
Date: Tue, 20 Dec 2022 12:21:37 +0300	[thread overview]
Message-ID: <20221220092137.6527-1-a.burakov@rosalinux.ru> (raw)

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@rosalinux.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,
 				 clk);
+	if (ret) {
+		dev_err(dev, "couldn't reset clk\n");
+		return ERR_PTR(ret);
+	}
 
 	return clk;
 }
-- 
2.25.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

WARNING: multiple messages have this Message-ID (diff)
From: Aleksandr Burakov <a.burakov@rosalinux.ru>
To: "Yue Wang" <yue.wang@amlogic.com>,
	"Hanjie Lin" <hanjie.lin@amlogic.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>
Cc: Aleksandr Burakov <a.burakov@rosalinux.ru>,
	linux-pci@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: [PATCH] PCI: amlogic: The check for devm_add_action_or_reset's return value added
Date: Tue, 20 Dec 2022 12:21:37 +0300	[thread overview]
Message-ID: <20221220092137.6527-1-a.burakov@rosalinux.ru> (raw)

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@rosalinux.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,
 				 clk);
+	if (ret) {
+		dev_err(dev, "couldn't reset clk\n");
+		return ERR_PTR(ret);
+	}
 
 	return clk;
 }
-- 
2.25.1


             reply	other threads:[~2022-12-20  9:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20  9:21 Aleksandr Burakov [this message]
2022-12-20  9:21 ` [PATCH] PCI: amlogic: The check for devm_add_action_or_reset's return value added Aleksandr Burakov
2022-12-29 19:43 ` Bjorn Helgaas
2022-12-29 19:43   ` Bjorn Helgaas
2022-12-29 21:43 ` Christophe JAILLET
2022-12-29 21:43   ` Christophe JAILLET

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=20221220092137.6527-1-a.burakov@rosalinux.ru \
    --to=a.burakov@rosalinux.ru \
    --cc=bhelgaas@google.com \
    --cc=hanjie.lin@amlogic.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=kw@linux.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=lvc-project@linuxtesting.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=yue.wang@amlogic.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.