diff options
| author | Tom Rini <[email protected]> | 2025-10-28 09:59:55 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-10-28 10:32:59 -0600 |
| commit | bf09c6abfc834f6c6df3c86fe40f36be1e209eb7 (patch) | |
| tree | fdce2bb6978a5bb2ad69dd6484798f4101970071 | |
| parent | 6e382d8fc5ee6876ade500222cb0ade9cdc597ed (diff) | |
| parent | 2a13b59ed4317ec4483d1502d9db161f46985a32 (diff) | |
Merge patch series "clk: versaclock: Fix two issues found by Smatch"
Andrew Goodbody <[email protected]> says:
Should return value calculated by ERR_PTR as calling code attempts to
check for it.
Also do not dereference a pointer that could be an error pointer before
checking it with IS_ERR.
Link: https://lore.kernel.org/r/[email protected]
| -rw-r--r-- | drivers/clk/clk_versaclock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/clk/clk_versaclock.c b/drivers/clk/clk_versaclock.c index 9ccaf13d242..19a787eaf0c 100644 --- a/drivers/clk/clk_versaclock.c +++ b/drivers/clk/clk_versaclock.c @@ -850,7 +850,7 @@ static char *versaclock_get_name(const char *dev_name, const char *clk_name, int buf = malloc(length); if (!buf) - ERR_PTR(-ENOMEM); + return ERR_PTR(-ENOMEM); if (index < 0) snprintf(buf, length, "%s.%s", dev_name, clk_name); @@ -904,12 +904,12 @@ int versaclock_probe(struct udevice *dev) if (IS_ERR(mux_name)) return PTR_ERR(mux_name); - clk_register(&vc5->clk_mux, "versaclock-mux", mux_name, vc5->pin_xin->dev->name); - - if (!IS_ERR(vc5->pin_xin)) + if (!IS_ERR(vc5->pin_xin)) { + clk_register(&vc5->clk_mux, "versaclock-mux", mux_name, vc5->pin_xin->dev->name); vc5_mux_set_parent(&vc5->clk_mux, 1); - else + } else { vc5_mux_set_parent(&vc5->clk_mux, 0); + } /* Configure Optional Loading Capacitance for external XTAL */ if (!(vc5->chip_info->flags & VC5_HAS_INTERNAL_XTAL)) { |
