Skip to content

Commit

Permalink
clk: sunxi: fix devm_ioremap_resource error detection code
Browse files Browse the repository at this point in the history
devm_ioremap_resource returns an ERR_PTR value, not NULL, on failure.

A simplified version of the semantic match that finds this problem is as
follows:

// <smpl>
@@
expression e,e1;
statement S;
@@

*e = devm_ioremap_resource(...);
if (!e1) S

// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by Boris BREZILLON <boris.brezillon@free-electrons.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
  • Loading branch information
Himangi Saraogi authored and Mike Turquette committed Jul 2, 2014
1 parent 2a96dfa commit c3dcac8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/clk/sunxi/clk-sun6i-apb0-gates.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev)

r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
reg = devm_ioremap_resource(&pdev->dev, r);
if (!reg)
if (IS_ERR(reg))
return PTR_ERR(reg);

clk_parent = of_clk_get_parent_name(np, 0);
Expand Down

0 comments on commit c3dcac8

Please sign in to comment.