Re: [PATCH 27/34] staging: mt7621-mmc: Fix bug on dma_alloc_coherent fail

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

 



On Mon, Apr 02 2018, Christian Lütke-Stetzkamp wrote:

> In case of dma_alloc_coherent failing the current code just called
> BUG_ON. By adding error handling for that case this can be avoided.
> This also fixes a memory leek in case of a fail later on in the probe
> function.
>
> Signed-off-by: Christian Lütke-Stetzkamp <christian@xxxxxxxx>
> ---
>  drivers/staging/mt7621-mmc/sd.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
> index 9cc8f4c8ef28..0d4877483e54 100644
> --- a/drivers/staging/mt7621-mmc/sd.c
> +++ b/drivers/staging/mt7621-mmc/sd.c
> @@ -2787,7 +2787,10 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  	/* using dma_alloc_coherent*/  /* todo: using 1, for all 4 slots */
>  	host->dma.gpd = dma_alloc_coherent(NULL, MAX_GPD_NUM * sizeof(struct gpt), &host->dma.gpd_addr, GFP_KERNEL);
>  	host->dma.bd =  dma_alloc_coherent(NULL, MAX_BD_NUM  * sizeof(struct bd),  &host->dma.bd_addr,  GFP_KERNEL);
> -	BUG_ON((!host->dma.gpd) || (!host->dma.bd));
> +	if (!host->dma.gdp || !host->dma.bd) {

That should be 'dma.gpd', not 'dma.gdp'.

Thanks,
NeilBrown

Attachment: signature.asc
Description: PGP signature

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux