aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulia Lawall <[email protected]>2009-08-06 15:07:41 -0700
committerLinus Torvalds <[email protected]>2009-08-07 10:39:56 -0700
commit2198a64a7487aba036f71998ade8a6528070d32c (patch)
tree6130ef502a8bca51a37fef1343a7c720b3359f99
parent20de03dae54e10271ffd308654dfb4a117f4789d (diff)
drivers/mmc: correct error-handling code
sdhci_alloc_host returns an ERR_PTR value in an error case instead of NULL. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @match exists@ expression x, E; statement S1, S2; @@ x = sdhci_alloc_host(...) ... when != x = E ( * if (x == NULL || ...) S1 else S2 | * if (x == NULL && ...) S1 else S2 ) // </smpl> Signed-off-by: Julia Lawall <[email protected]> Acked-by: Anton Vorontsov <[email protected]> Cc: Matt Fleming <[email protected]> Cc: Ian Molton <[email protected]> Cc: "Roberto A. Foglietta" <[email protected]> Cc: Philip Langdale <[email protected]> Cc: Pierre Ossman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--drivers/mmc/host/sdhci-of.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of.c
index 908844327db0..1e8aa590bb39 100644
--- a/drivers/mmc/host/sdhci-of.c
+++ b/drivers/mmc/host/sdhci-of.c
@@ -234,7 +234,7 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev,
return -ENODEV;
host = sdhci_alloc_host(&ofdev->dev, sizeof(*of_host));
- if (!host)
+ if (IS_ERR(host))
return -ENOMEM;
of_host = sdhci_priv(host);