clk: ti: fix ti_clk_get_reg_addr error handling
There is a case where NULL can be a valid return value for ti_clk_get_reg_addr, specifically the case where both the provider index and register offsets are zero. In this case, the current error checking against a NULL pointer will fail. Thus, change the API to return a ERR_PTR value in an error case, and change all the users of this API to check against IS_ERR instead. Signed-off-by: Tero Kristo <t-kristo@ti.com> Acked-by: Michael Turquette <mturquette@linaro.org>
This commit is contained in:
@@ -119,7 +119,7 @@ int __init of_ti_clk_autoidle_setup(struct device_node *node)
|
||||
clk->name = node->name;
|
||||
clk->reg = ti_clk_get_reg_addr(node, 0);
|
||||
|
||||
if (!clk->reg) {
|
||||
if (IS_ERR(clk->reg)) {
|
||||
kfree(clk);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user