From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mateusz Kulikowski Date: Thu, 30 Jun 2016 21:18:56 +0200 Subject: [U-Boot] [PATCH] MMC: Do not write to mmc_uclass_priv if it was not allocated In-Reply-To: References: <576EFE30.4060501@bluematt.me> Message-ID: <577570A0.1050407@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 29.06.2016 05:27, Simon Glass wrote: > Hi Matt, > > On 25 June 2016 at 14:57, Matt Corallo wrote: >> Signed-off-by: Matt Corallo >> --- >> drivers/mmc/mmc.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c >> index aabfc71..eba20f0 100644 >> --- a/drivers/mmc/mmc.c >> +++ b/drivers/mmc/mmc.c >> @@ -1734,7 +1734,8 @@ int mmc_init(struct mmc *mmc) >> #ifdef CONFIG_DM_MMC >> struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc->dev); >> >> - upriv->mmc = mmc; >> + if (upriv) >> + upriv->mmc = mmc; >> #endif >> if (mmc->has_init) >> return 0; >> -- >> 2.1.4 > > Can you please add a commit message explaining why this is needed and > what it fixes? How can mmc_init() be called before the MMC device is > there? Is this related to this patch? > > http://patchwork.ozlabs.org/patch/640735/ It's related in a way that it fixed crash of dragonboard before I submitted my patch :) Not sure if it meant to fix dragonboard or some other board. Although - imho - it's nice to make check like that.. or at least some kind of assert. Mateusz