summaryrefslogtreecommitdiff
path: root/arch/arm/mach-stm32mp/cmd_stm32prog
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-07-06 13:20:58 +0200
committerPatrice Chotard <patrice.chotard@st.com>2020-07-28 17:43:46 +0200
commitded48bec0568c7e94d3ef5ea10b13a46d0fd26a6 (patch)
treea29481523880abc2e560c979ac51a77c8a1a224d /arch/arm/mach-stm32mp/cmd_stm32prog
parent4b64265bb472fba6c820eb81074221c4bd485ba2 (diff)
arm: stm32mp: stm32prog: check result of find_mmc_device
Check result of find_mmc_device() before calling mmc_init(). This patch avoid a data abort when the command try to acces to sd/mmc device deactivated in device tree. Fixes: aff4c5dd8265 ("stm32mp: stm32prog: add MMC device") Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog')
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
index c5b8841b23c..e4199dbaa59 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
@@ -560,7 +560,7 @@ static int init_device(struct stm32prog_data *data,
#ifdef CONFIG_MMC
case STM32PROG_MMC:
mmc = find_mmc_device(dev->dev_id);
- if (mmc_init(mmc)) {
+ if (!mmc || mmc_init(mmc)) {
stm32prog_err("mmc device %d not found", dev->dev_id);
return -ENODEV;
}