lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210423171335.262316-3-tudor.ambarus@microchip.com>
Date:   Fri, 23 Apr 2021 20:13:34 +0300
From:   Tudor Ambarus <tudor.ambarus@...rochip.com>
To:     <mturquette@...libre.com>, <sboyd@...nel.org>, <nsaenz@...nel.org>,
        <maxime@...no.tech>, <gregkh@...uxfoundation.org>,
        <rafael@...nel.org>, <khilman@...nel.org>,
        <ulf.hansson@...aro.org>, <len.brown@...el.com>, <pavel@....cz>,
        <robh+dt@...nel.org>, <frowand.list@...il.com>, <maz@...nel.org>,
        <tglx@...utronix.de>, <saravanak@...gle.com>,
        <geert@...ux-m68k.org>, <nsaenzjulienne@...e.de>,
        <linux@...ck-us.net>, <guillaume.tucker@...labora.com>
CC:     <linux-clk@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <corbet@....net>, <nicolas.ferre@...rochip.com>,
        <claudiu.beznea@...rochip.com>, <linux-doc@...r.kernel.org>,
        <linux-pm@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <linux-acpi@...r.kernel.org>, <kernel-team@...roid.com>,
        <linux-rpi-kernel@...ts.infradead.org>,
        Tudor Ambarus <tudor.ambarus@...rochip.com>,
        Marek Szyprowski <m.szyprowski@...sung.com>
Subject: [PATCH 2/2] clk: bcm: rpi: Do not call devm_of_clk_add_hw_provider with a NULL dev->of_node

devm_of_clk_add_hw_provider() expects, as the "_of_" string indicates,
a non NULL dev->of_node, otherwise it will return -ENODEV.
Since this driver can be probed either through the old-fashioned
platform device registration or through a DT node that is a child of the
firmware node, call devm_of_clk_add_hw_provider() only when the DT node
is present.

Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>
Fixes: 6579c8d97ad7 ("clk: Mark fwnodes when their clock provider is added")
Signed-off-by: Tudor Ambarus <tudor.ambarus@...rochip.com>
---
 drivers/clk/bcm/clk-raspberrypi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
index dd3b71eafabf..84a4e14babff 100644
--- a/drivers/clk/bcm/clk-raspberrypi.c
+++ b/drivers/clk/bcm/clk-raspberrypi.c
@@ -337,10 +337,12 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
-					  clk_data);
-	if (ret)
-		return ret;
+	if (dev->of_node) {
+		ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
+						  clk_data);
+		if (ret)
+			return ret;
+	}
 
 	rpi->cpufreq = platform_device_register_data(dev, "raspberrypi-cpufreq",
 						     -1, NULL, 0);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ