Commit bb4031b
clk: Skip clk provider registration when np is NULL
commit 6579c8d ("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.
Fixes: 6579c8d ("clk: Mark fwnodes when their clock provider is added")
Fixes: 3c9ea42 ("clk: Mark fwnodes when their clock provider is added/removed")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Saravana Kannan <saravanak@google.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20210426065618.588144-1-tudor.ambarus@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 28ec344 commit bb4031b
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4540 | 4540 | | |
4541 | 4541 | | |
4542 | 4542 | | |
| 4543 | + | |
| 4544 | + | |
| 4545 | + | |
4543 | 4546 | | |
4544 | 4547 | | |
4545 | 4548 | | |
| |||
4579 | 4582 | | |
4580 | 4583 | | |
4581 | 4584 | | |
| 4585 | + | |
| 4586 | + | |
| 4587 | + | |
4582 | 4588 | | |
4583 | 4589 | | |
4584 | 4590 | | |
| |||
4676 | 4682 | | |
4677 | 4683 | | |
4678 | 4684 | | |
| 4685 | + | |
| 4686 | + | |
| 4687 | + | |
4679 | 4688 | | |
4680 | 4689 | | |
4681 | 4690 | | |
| |||
0 commit comments