[U-Boot] [PATCH 016/126] sandbox: mmc: Fix up MMC emulator for valgrind

Bin Meng bmeng.cn at gmail.com
Sun Oct 6 09:27:36 UTC 2019


On Sat, Oct 5, 2019 at 9:58 AM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg at chromium.org> wrote:
> >
> > At present running sandbox with valgrind produces some warnings due to the
> > MMC emulator not filling in all the expected fields. Fix it.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >  drivers/mmc/sandbox_mmc.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
> > index 2fa7d8c3dcd..7ca8da0946c 100644
> > --- a/drivers/mmc/sandbox_mmc.c
> > +++ b/drivers/mmc/sandbox_mmc.c
> > @@ -27,6 +27,7 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
> >  {
> >         switch (cmd->cmdidx) {
> >         case MMC_CMD_ALL_SEND_CID:
> > +               memset(cmd->response, '\0', 16);
>
> sizeof(cmd->response)

Changed to use sizeof(), and

>
> >                 break;
> >         case SD_CMD_SEND_RELATIVE_ADDR:
> >                 cmd->response[0] = 0 << 16; /* mmc->rca */
> > @@ -43,11 +44,14 @@ static int sandbox_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
> >         case MMC_CMD_SEND_CSD:
> >                 cmd->response[0] = 0;
> >                 cmd->response[1] = 10 << 16;    /* 1 << block_len */
> > +               cmd->response[2] = 0;
> > +               cmd->response[3] = 0;
> >                 break;
> >         case SD_CMD_SWITCH_FUNC: {
> >                 if (!data)
> >                         break;
> >                 u32 *resp = (u32 *)data->dest;
> > +               resp[3] = 0;
> >                 resp[7] = cpu_to_be32(SD_HIGHSPEED_BUSY);
> >                 if ((cmd->cmdarg & 0xF) == UHS_SDR12_BUS_SPEED)
> >                         resp[4] = (cmd->cmdarg & 0xF) << 24;
> > --
>
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
> Tested-by: Bin Meng <bmeng.cn at gmail.com>

applied to u-boot-x86/next, thanks!


More information about the U-Boot mailing list