Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 442a9022 authored by Julia Lawall's avatar Julia Lawall Committed by Russell King
Browse files

[ARM] arch/arm/common/sa1111.c: Correct error handling code

If it is reasonable to apply PTR_ERR to the result of calling clk_get, then
that result should first be tested with IS_ERR, not with !.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/

)

// <smpl>
@@
expression E,E1;
@@

if (
-   E == NULL
+   IS_ERR(E)
   ) { <+... when != E = E1
        PTR_ERR(E)
       ...+> }
// </smpl>

Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 674a0a69
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -630,7 +630,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
		return -ENOMEM;

	sachip->clk = clk_get(me, "SA1111_CLK");
	if (!sachip->clk) {
	if (IS_ERR(sachip->clk)) {
		ret = PTR_ERR(sachip->clk);
		goto err_free;
	}