mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-16 14:08:45 +00:00
mmc: zynq_sdhci: fix uninitialized pointer deref on probe
Since commit3d296365e4
("mmc: sdhci: Add support for sdhci-caps-mask") sdhci_setup_cfg() expects a valid sdhci_host mmc field. Move the mmc field initialization before sdhci_setup_cfg() call to avoid crash on mmc pointer dereference. [this patch is based on commit41a9fab8da
("mmc: mv_sdhci: fix uninitialized pointer deref on probe") by Baruch Siach] Fixes:3d296365e4
("mmc: sdhci: Add support for sdhci-caps-mask") Cc: Faiz Abbas <faiz_abbas@ti.com> Cc: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Tested-by: Michal Simek <michal.simek@xilinx.com> (on zcu102/zc706)
This commit is contained in:
parent
68b3e8b398
commit
3148a3c2d3
1 changed files with 4 additions and 3 deletions
|
@ -242,13 +242,14 @@ static int arasan_sdhci_probe(struct udevice *dev)
|
|||
|
||||
host->max_clk = clock;
|
||||
|
||||
host->mmc = &plat->mmc;
|
||||
host->mmc->dev = dev;
|
||||
host->mmc->priv = host;
|
||||
|
||||
ret = sdhci_setup_cfg(&plat->cfg, host, plat->f_max,
|
||||
CONFIG_ZYNQ_SDHCI_MIN_FREQ);
|
||||
host->mmc = &plat->mmc;
|
||||
if (ret)
|
||||
return ret;
|
||||
host->mmc->priv = host;
|
||||
host->mmc->dev = dev;
|
||||
upriv->mmc = host->mmc;
|
||||
|
||||
return sdhci_probe(dev);
|
||||
|
|
Loading…
Add table
Reference in a new issue