Re: [PATCH v2] mmc: sdhci-of-esdhc: fix unchecked return value issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/11/18 4:20 AM, BOUGH CHEN wrote:
> Calling dma_set_mask_and_coherent without checking return value.
> This was caught by coverity scan.
> 
> Fix this by check the return value, and give a warning if get a
> false.
> 
> Acked-by: Yangbo Lu <Yangbo.lu@xxxxxxx>
> Signed-off-by: Haibo Chen <haibo.chen@xxxxxxx>
> ---
>  drivers/mmc/host/sdhci-of-esdhc.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 86fc9f0..51513fd 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -475,11 +475,17 @@ static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask)
>  static int esdhc_of_enable_dma(struct sdhci_host *host)
>  {
>  	u32 value;
> +	int ret;
>  	struct device *dev = mmc_dev(host->mmc);
>  
>  	if (of_device_is_compatible(dev->of_node, "fsl,ls1043a-esdhc") ||
> -	    of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc"))
> -		dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
> +	    of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) {
> +		ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));

Why isn't the dma mask set up during initialization?

> +		if (ret) {
> +			pr_warn("%s: Failed to set 40-bit DMA mask.\n",
> +				mmc_hostname(host->mmc));
> +		}
> +	}
>  
>  	value = sdhci_readl(host, ESDHC_DMA_SYSCTL);
>  	value |= ESDHC_DMA_SNOOP;
> 




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux