Commit 5ac382c3 authored by Maxime Ripard's avatar Maxime Ripard

clk: sunxi: Fix of_io_request_and_map error check

of_io_request_and map returns an error pointer, but the current code assumes
that on error the returned pointer will be NULL.

Obviously, that makes the check completely useless. Change the test to actually
check for the proper error code.
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org
parent b787f68c
...@@ -93,7 +93,7 @@ static void __init sun9i_a80_pll4_setup(struct device_node *node) ...@@ -93,7 +93,7 @@ static void __init sun9i_a80_pll4_setup(struct device_node *node)
void __iomem *reg; void __iomem *reg;
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); reg = of_io_request_and_map(node, 0, of_node_full_name(node));
if (!reg) { if (IS_ERR(reg)) {
pr_err("Could not get registers for a80-pll4-clk: %s\n", pr_err("Could not get registers for a80-pll4-clk: %s\n",
node->name); node->name);
return; return;
...@@ -154,7 +154,7 @@ static void __init sun9i_a80_gt_setup(struct device_node *node) ...@@ -154,7 +154,7 @@ static void __init sun9i_a80_gt_setup(struct device_node *node)
struct clk *gt; struct clk *gt;
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); reg = of_io_request_and_map(node, 0, of_node_full_name(node));
if (!reg) { if (IS_ERR(reg)) {
pr_err("Could not get registers for a80-gt-clk: %s\n", pr_err("Could not get registers for a80-gt-clk: %s\n",
node->name); node->name);
return; return;
...@@ -218,7 +218,7 @@ static void __init sun9i_a80_ahb_setup(struct device_node *node) ...@@ -218,7 +218,7 @@ static void __init sun9i_a80_ahb_setup(struct device_node *node)
void __iomem *reg; void __iomem *reg;
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); reg = of_io_request_and_map(node, 0, of_node_full_name(node));
if (!reg) { if (IS_ERR(reg)) {
pr_err("Could not get registers for a80-ahb-clk: %s\n", pr_err("Could not get registers for a80-ahb-clk: %s\n",
node->name); node->name);
return; return;
...@@ -244,7 +244,7 @@ static void __init sun9i_a80_apb0_setup(struct device_node *node) ...@@ -244,7 +244,7 @@ static void __init sun9i_a80_apb0_setup(struct device_node *node)
void __iomem *reg; void __iomem *reg;
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); reg = of_io_request_and_map(node, 0, of_node_full_name(node));
if (!reg) { if (IS_ERR(reg)) {
pr_err("Could not get registers for a80-apb0-clk: %s\n", pr_err("Could not get registers for a80-apb0-clk: %s\n",
node->name); node->name);
return; return;
...@@ -310,7 +310,7 @@ static void __init sun9i_a80_apb1_setup(struct device_node *node) ...@@ -310,7 +310,7 @@ static void __init sun9i_a80_apb1_setup(struct device_node *node)
void __iomem *reg; void __iomem *reg;
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); reg = of_io_request_and_map(node, 0, of_node_full_name(node));
if (!reg) { if (IS_ERR(reg)) {
pr_err("Could not get registers for a80-apb1-clk: %s\n", pr_err("Could not get registers for a80-apb1-clk: %s\n",
node->name); node->name);
return; return;
......
...@@ -198,6 +198,8 @@ static void __init sun6i_ahb1_clk_setup(struct device_node *node) ...@@ -198,6 +198,8 @@ static void __init sun6i_ahb1_clk_setup(struct device_node *node)
int i = 0; int i = 0;
reg = of_io_request_and_map(node, 0, of_node_full_name(node)); reg = of_io_request_and_map(node, 0, of_node_full_name(node));
if (IS_ERR(reg))
return;
/* we have a mux, we will have >1 parents */ /* we have a mux, we will have >1 parents */
while (i < SUN6I_AHB1_MAX_PARENTS && while (i < SUN6I_AHB1_MAX_PARENTS &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment