summaryrefslogtreecommitdiff
path: root/drivers/clk/clk-uclass.c
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-12-05 17:03:36 -0600
committerTom Rini <[email protected]>2025-12-05 17:03:36 -0600
commitbc1819331ece7aa4e7d0573c9cdacdb8efbdb067 (patch)
tree9a669ac84720f4530171d90dac826e057e5b216c /drivers/clk/clk-uclass.c
parent1165e8efcba0ab3efd1ea4ff956d26746fc386b0 (diff)
parent33285945518731ed459680ffb01891c4804fb6c9 (diff)
Merge patch series "clk: Return value calculated by ERR_PTR"
Andrew Goodbody <[email protected]> says: Smatch reported an error where a value calculated by ERR_PTR was not used. Fixing this to return the generated value led to a test failure which meant updating the sandbox clock code so that it would still cause the tests to pass with the above correction. Debugging this problem led to a SIGSEGV which is addressed in 1/3. Possible memory leaks noticed are addressed in 3/3. Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/clk/clk-uclass.c')
-rw-r--r--drivers/clk/clk-uclass.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index ae787b88510..4a438181ba9 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -199,7 +199,7 @@ static struct clk *clk_set_default_get_by_id(struct clk *clk)
if (ret) {
debug("%s(): could not get parent clock pointer, id %lu\n",
__func__, clk->id);
- ERR_PTR(ret);
+ return ERR_PTR(ret);
}
}
@@ -338,7 +338,7 @@ static int clk_set_default_rates(struct udevice *dev,
continue;
}
- return ret;
+ goto fail;
}
/* This is clk provider device trying to program itself
@@ -354,7 +354,7 @@ static int clk_set_default_rates(struct udevice *dev,
c = clk_set_default_get_by_id(&clk);
if (IS_ERR(c))
- return PTR_ERR(c);
+ continue;
ret = clk_set_rate(c, rates[index]);
@@ -662,7 +662,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);
@@ -723,7 +723,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);