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:
@@ -203,7 +203,7 @@ static void __init of_dra7_apll_setup(struct device_node *node)
|
||||
ad->control_reg = ti_clk_get_reg_addr(node, 0);
|
||||
ad->idlest_reg = ti_clk_get_reg_addr(node, 1);
|
||||
|
||||
if (!ad->control_reg || !ad->idlest_reg)
|
||||
if (IS_ERR(ad->control_reg) || IS_ERR(ad->idlest_reg))
|
||||
goto cleanup;
|
||||
|
||||
ad->idlest_mask = 0x1;
|
||||
@@ -384,7 +384,8 @@ static void __init of_omap2_apll_setup(struct device_node *node)
|
||||
ad->autoidle_reg = ti_clk_get_reg_addr(node, 1);
|
||||
ad->idlest_reg = ti_clk_get_reg_addr(node, 2);
|
||||
|
||||
if (!ad->control_reg || !ad->autoidle_reg || !ad->idlest_reg)
|
||||
if (IS_ERR(ad->control_reg) || IS_ERR(ad->autoidle_reg) ||
|
||||
IS_ERR(ad->idlest_reg))
|
||||
goto cleanup;
|
||||
|
||||
clk = clk_register(NULL, &clk_hw->hw);
|
||||
|
Reference in New Issue
Block a user