Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 8631/1: clkdev: Detect errors in clk_hw_register_clkdev() for mass registration

Unlike clk_register_clkdev(), clk_hw_register_clkdev() doesn't check for
passed error objects from a previous registration call. Hence the caller
of clk_hw_register_*() has to check for errors before calling
clk_hw_register_clkdev*().

Make clk_hw_register_clkdev() more similar to clk_register_clkdev() by
adding this error check, removing the burden from callers that do mass
registration.

Fixes: e4f1b49bda6d6aa2 ("clkdev: Add clk_hw based registration APIs")
Fixes: 944b9a41e004534f ("clk: ls1x: Migrate to clk_hw based OF and registration APIs")
Fixes: 44ce9a9ae977736f ("MIPS: TXx9: Convert to Common Clock Framework")
Fixes: f48d947a162dfa9d ("clk: clps711x: Migrate to clk_hw based OF and registration APIs")
Fixes: b4626a7f489238a5 ("CLK: Add Loongson1C clock support")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Geert Uytterhoeven and committed by
Russell King
9388093d 1001354c

+8
+8
drivers/clk/clkdev.c
··· 448 448 * 449 449 * con_id or dev_id may be NULL as a wildcard, just as in the rest of 450 450 * clkdev. 451 + * 452 + * To make things easier for mass registration, we detect error clk_hws 453 + * from a previous clk_hw_register_*() call, and return the error code for 454 + * those. This is to permit this function to be called immediately 455 + * after clk_hw_register_*(). 451 456 */ 452 457 int clk_hw_register_clkdev(struct clk_hw *hw, const char *con_id, 453 458 const char *dev_id) 454 459 { 455 460 struct clk_lookup *cl; 461 + 462 + if (IS_ERR(hw)) 463 + return PTR_ERR(hw); 456 464 457 465 /* 458 466 * Since dev_id can be NULL, and NULL is handled specially, we must