Thread (6 messages) 6 messages, 6 authors, 2021-05-11

Re: [PATCH v2] clk: Skip clk provider registration when np is NULL

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2021-05-11 07:11:07
Also in: linux-acpi, linux-clk, linux-devicetree, linux-pm, lkml

On Mon, May 10, 2021 at 12:36:45PM -0700, Guenter Roeck wrote:
On Mon, Apr 26, 2021 at 09:56:18AM +0300, Tudor Ambarus wrote:
quoted
commit 6579c8d97ad7 ("clk: Mark fwnodes when their clock provider is added")
revealed that clk/bcm/clk-raspberrypi.c driver calls
devm_of_clk_add_hw_provider(), with a NULL dev->of_node, which resulted in a
NULL pointer dereference in of_clk_add_hw_provider() when calling
fwnode_dev_initialized().

Returning 0 is reducing the if conditions in driver code and is being
consistent with the CONFIG_OF=n inline stub that returns 0 when CONFIG_OF
is disabled. The downside is that drivers will maybe register clkdev lookups
when they don't need to and waste some memory.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Fixes: 6579c8d97ad7 ("clk: Mark fwnodes when their clock provider is added")
Fixes: 3c9ea42802a1 ("clk: Mark fwnodes when their clock provider is added/removed")
Signed-off-by: Tudor Ambarus <redacted>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Now applied to my tree, thanks and sorry for the delay, I thought this
was going through the clk tree.

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help