Merge patch series "clk: versaclock: Fix two issues found by Smatch"

Andrew Goodbody <andrew.goodbody@linaro.org> 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/20250723-clk_versaclock-v1-0-9d70f2530871@linaro.org
This commit is contained in:
Tom Rini 2025-10-28 09:59:55 -06:00
commit bf09c6abfc

View File

@ -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)) {