[PATCH] mmc: mediatek: fix mem leak in msdc_drv_probe

Chaotian Jing chaotian.jing at mediatek.com
Thu Nov 12 03:51:59 EST 2020


On Thu, 2020-11-12 at 17:25 +0800, Zheng Liang wrote:
> It should use mmc_free_host to free mem in error patch of
> msdc_drv_probe.
> 
> Reported-by: Hulk Robot <hulkci at huawei.com>
> Signed-off-by: Zheng Liang <zhengliang6 at huawei.com>
Reviewed-by: Chaotian Jing <chaotian.jing at mediatek.com>
> ---
>  drivers/mmc/host/mtk-sd.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index fc5ee5df91ad..eac7838e2dac 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -2504,8 +2504,10 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  
>  	host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
>  								"hrst");
> -	if (IS_ERR(host->reset))
> -		return PTR_ERR(host->reset);
> +	if (IS_ERR(host->reset)) {
> +		ret = PTR_ERR(host->reset);
> +		goto host_free;
> +	}
>  
>  	host->irq = platform_get_irq(pdev, 0);
>  	if (host->irq < 0) {



More information about the Linux-mediatek mailing list