Commit 2198a64a authored by Julia Lawall's avatar Julia Lawall Committed by Linus Torvalds

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: default avatarJulia Lawall <julia@diku.dk>
Acked-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Cc: Matt Fleming <matt@console-pimps.org>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Cc: Philip Langdale <philipl@overt.org>
Cc: Pierre Ossman <pierre@ossman.eu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 20de03da
...@@ -234,7 +234,7 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev, ...@@ -234,7 +234,7 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev,
return -ENODEV; return -ENODEV;
host = sdhci_alloc_host(&ofdev->dev, sizeof(*of_host)); host = sdhci_alloc_host(&ofdev->dev, sizeof(*of_host));
if (!host) if (IS_ERR(host))
return -ENOMEM; return -ENOMEM;
of_host = sdhci_priv(host); of_host = sdhci_priv(host);
......
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