summaryrefslogtreecommitdiff
path: root/drivers/dfu/dfu_mmc.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-12-18 12:37:18 -0500
committerTom Rini <trini@ti.com>2014-12-18 12:37:18 -0500
commit7a7ffedabd29adde9cb6ebe6066256c4cf8b77af (patch)
tree6122c4c1e597e26b0c0a3ae706086cf9c2ba880e /drivers/dfu/dfu_mmc.c
parentd8bec60c1b0de7770f9b56ad092ab9be801d99af (diff)
parent0ff7e585df83470139739533bdbf41114f395470 (diff)
downloadu-boot-imx-7a7ffedabd29adde9cb6ebe6066256c4cf8b77af.zip
u-boot-imx-7a7ffedabd29adde9cb6ebe6066256c4cf8b77af.tar.gz
u-boot-imx-7a7ffedabd29adde9cb6ebe6066256c4cf8b77af.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-usb
Diffstat (limited to 'drivers/dfu/dfu_mmc.c')
-rw-r--r--drivers/dfu/dfu_mmc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 72fa03e..62d72fe 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -40,10 +40,16 @@ static int mmc_access_part(struct dfu_entity *dfu, struct mmc *mmc, int part)
static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
u64 offset, void *buf, long *len)
{
- struct mmc *mmc = find_mmc_device(dfu->data.mmc.dev_num);
+ struct mmc *mmc;
u32 blk_start, blk_count, n = 0;
int ret, part_num_bkp = 0;
+ mmc = find_mmc_device(dfu->data.mmc.dev_num);
+ if (!mmc) {
+ error("Device MMC %d - not found!", dfu->data.mmc.dev_num);
+ return -ENODEV;
+ }
+
/*
* We must ensure that we work in lba_blk_size chunks, so ALIGN
* this value.