clk: check parent_name in clk_register to avoid confusing log_error() output
For some gate clocks and fixed clocks without a parent, calling clk_register will print an useless error message indicating that parent is missing. Fix that by gaurding log_xxx() with an if-statement. Signed-off-by: Yang Xiwen <forbidden405@outlook.com> Suggested-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Sean Anderson <seanga2@gmail.com> Link: https://lore.kernel.org/r/20230807-clk-fix-v2-1-0b688e21fb4e@outlook.com
This commit is contained in:
parent
3ac22891cf
commit
09844d0de5
|
@ -18,17 +18,19 @@
|
|||
int clk_register(struct clk *clk, const char *drv_name,
|
||||
const char *name, const char *parent_name)
|
||||
{
|
||||
struct udevice *parent;
|
||||
struct udevice *parent = NULL;
|
||||
struct driver *drv;
|
||||
int ret;
|
||||
|
||||
ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);
|
||||
if (ret) {
|
||||
log_err("%s: failed to get %s device (parent of %s)\n",
|
||||
__func__, parent_name, name);
|
||||
} else {
|
||||
log_debug("%s: name: %s parent: %s [0x%p]\n", __func__, name,
|
||||
parent->name, parent);
|
||||
if (parent_name) {
|
||||
ret = uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);
|
||||
if (ret) {
|
||||
log_err("%s: failed to get %s device (parent of %s)\n",
|
||||
__func__, parent_name, name);
|
||||
} else {
|
||||
log_debug("%s: name: %s parent: %s [0x%p]\n", __func__, name,
|
||||
parent->name, parent);
|
||||
}
|
||||
}
|
||||
|
||||
drv = lists_driver_lookup_name(drv_name);
|
||||
|
|
Loading…
Reference in New Issue
Block a user