mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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]>
This commit is contained in:
parent
20de03dae5
commit
2198a64a74
1 changed files with 1 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue