Re: [PATCH] mmc: alcor: Fix a resource leak in an error handling path in 'alcor_pci_sdmmc_drv_probe()'

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

 



> If 'devm_request_threaded_irq()' fails, resources allocated by
> 'mmc_alloc_host()' must be freed.

How do you think about a wording variant like the following?

   Subject:
   [PATCH v2] mmc: alcor: Complete exception handling in alcor_pci_sdmmc_drv_probe()

   Change description (according to a solution alternative):
   The exception handling was incomplete in an if branch
   after a failed call of the function “devm_request_threaded_irq”.
   Thus add a call of the function “mmc_free_host” for the release of
   corresponding system resources.


> +++ b/drivers/mmc/host/alcor.c
> @@ -1104,7 +1104,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
>
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to get irq for data line\n");
> -		return ret;
> +		goto free_host;
>  	}
>
>  	mutex_init(&host->cmd_mutex);

You propose to perform a jump to other code only once in this implementation.
I find it more succinct to call the desired function then directly.

 		dev_err(…);
+		mmc_free_host(mmc);
 		return ret;


Regards,
Markus




[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