From: Andrew Goodbody Date: Fri, 21 Nov 2025 17:34:31 +0000 (+0000) Subject: clk: Prevent SIGSEGV on debug X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c0a46e2918a1ddf42f51449e45077513dd52417;p=thirdparty%2Fu-boot.git clk: Prevent SIGSEGV on debug If LOG_DEBUG is defined and a NULL clk is passed to clk_enable or clk_disable then an attempt is made to dereference NULL in the debug statement. Guard against this. Signed-off-by: Andrew Goodbody Reviewed-by: Patrick Delaunay --- diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 3dbe1ce9441..1f55dbe385b 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -660,7 +660,7 @@ int clk_enable(struct clk *clk) struct clk *clkp = NULL; int ret; - debug("%s(clk=%p name=%s)\n", __func__, clk, clk->dev->name); + debug("%s(clk=%p name=%s)\n", __func__, clk, clk ? clk->dev->name : "NULL"); if (!clk_valid(clk)) return 0; ops = clk_dev_ops(clk->dev); @@ -721,7 +721,7 @@ int clk_disable(struct clk *clk) struct clk *clkp = NULL; int ret; - debug("%s(clk=%p name=%s)\n", __func__, clk, clk->dev->name); + debug("%s(clk=%p name=%s)\n", __func__, clk, clk ? clk->dev->name : "NULL"); if (!clk_valid(clk)) return 0; ops = clk_dev_ops(clk->dev);