From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Anderson Date: Sun, 31 Jan 2021 23:57:38 -0500 Subject: [PATCH v2] mmc: mmc_spi: Print verbose debug output when crc16 check fails In-Reply-To: <20210117122724.5321-1-bmeng.cn@gmail.com> References: <20210117122724.5321-1-bmeng.cn@gmail.com> Message-ID: <44c1aacd-3405-b59e-eaaf-a67194e94dd6@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 1/17/21 7:27 AM, Bin Meng wrote: > Add some verbose debug output when crc16 check fails. > > Signed-off-by: Bin Meng > Reviewed-by: Jaehoon Chung > > --- > > Changes in v2: > - do the crc_ok assignment at the the same line where it's defined > > drivers/mmc/mmc_spi.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c > index 46800bbed2..b1edb6ad7c 100644 > --- a/drivers/mmc/mmc_spi.c > +++ b/drivers/mmc/mmc_spi.c > @@ -181,8 +181,10 @@ static int mmc_spi_readdata(struct udevice *dev, > if (ret) > return ret; > #ifdef CONFIG_MMC_SPI_CRC_ON > - if (be16_to_cpu(crc16_ccitt(0, buf, bsize)) != crc) { > - debug("%s: data crc error\n", __func__); > + u16 crc_ok = be16_to_cpu(crc16_ccitt(0, buf, bsize)); > + if (crc_ok != crc) { > + debug("%s: data crc error, expect %04x get %04x\n", Nit: Perhaps use expected/got? Otherwise looks good to me; I ended up creating a similar patch previously, but never got around to upstreaming it. --Sean > + __func__, crc_ok, crc); > r1 = R1_SPI_COM_CRC; > break; > } >