[PATCH] mmc: mmc_spi: Print verbose debug output when crc16 check fails

Jaehoon Chung jh80.chung at samsung.com
Thu Jan 7 00:36:06 CET 2021


Hi Bin,

On 1/6/21 9:47 PM, Bin Meng wrote:
> Add some verbose debug output when crc16 check fails.
> 
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
> 
>  drivers/mmc/mmc_spi.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
> index 50fcd32674..87d7edffd5 100644
> --- a/drivers/mmc/mmc_spi.c
> +++ b/drivers/mmc/mmc_spi.c
> @@ -181,8 +181,11 @@ 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;
> +			crc_ok = be16_to_cpu(crc16_ccitt(0, buf, bsize));

How about "u16 crc_ok = be16_to_cpu();" ?

Reviewed-by: Jaehoon Chung <jh80.chung at samsung.com>

Best Regards,
Jaehoon Chung

> +			if (crc_ok != crc) {
> +				debug("%s: data crc error, expect %04x get %04x\n",
> +				      __func__, crc_ok, crc);
>  				r1 = R1_SPI_COM_CRC;
>  				break;
>  			}
> 



More information about the U-Boot mailing list