diff options
author | Rabin Vincent <rabin@rab.in> | 2009-04-05 08:00:53 (GMT) |
---|---|---|
committer | Andy Fleming <afleming@freescale.com> | 2009-06-02 22:18:56 (GMT) |
commit | e85649c7e683faea1ccfddc9fa9abc62f38e4201 (patch) | |
tree | ee1f5c96aba8a19b2567d0f542e787f81a1f13f1 /drivers | |
parent | ac0865ff33870cdf2cd480165045e1bc311e9fa2 (diff) | |
download | u-boot-e85649c7e683faea1ccfddc9fa9abc62f38e4201.tar.xz |
mmc: check find_mmc_device return value
find_mmc_device returns NULL if an invalid device number is specified.
Check for this to avoid dereferencing NULL pointers.
Signed-off-by: Rabin Vincent <rabin@rab.in>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/mmc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 7791c38..70b4130 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -846,7 +846,7 @@ block_dev_desc_t *mmc_get_dev(int dev) { struct mmc *mmc = find_mmc_device(dev); - return &mmc->block_dev; + return mmc ? &mmc->block_dev : NULL; } int mmc_init(struct mmc *mmc) |