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>
This commit is contained in:
committed by
Andy Fleming
parent
ac0865ff33
commit
e85649c7e6
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user