[PATCH 1/8] coresight: ultrasoc-smb: Fix resource leak in .remove()

hejunhao hejunhao3 at huawei.com
Thu Nov 9 01:41:55 PST 2023


On 2023/11/8 4:28, Uwe Kleine-König wrote:
> If smb_config_inport() fails it's still necessary to unregister all
> resources. As smb_config_inport() already emits an error message on
> failure, there is no need to add another one. By not returning the error
> code, a second error message (about the return value being ignored) is
> suppressed.
>
> Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>

Hi,

thanks, for the report. Can you try this patch and help review it?

https://lore.kernel.org/linux-arm-kernel/20231021083822.18239-3-hejunhao3@huawei.com/ 


This patch should have fixed this issue.

Best regards,
Junhao.


> ---
>   drivers/hwtracing/coresight/ultrasoc-smb.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c
> index e9a32a97fbee..10e7d4852112 100644
> --- a/drivers/hwtracing/coresight/ultrasoc-smb.c
> +++ b/drivers/hwtracing/coresight/ultrasoc-smb.c
> @@ -613,11 +613,8 @@ static int smb_probe(struct platform_device *pdev)
>   static int smb_remove(struct platform_device *pdev)
>   {
>   	struct smb_drv_data *drvdata = platform_get_drvdata(pdev);
> -	int ret;
>   
> -	ret = smb_config_inport(&pdev->dev, false);
> -	if (ret)
> -		return ret;
> +	smb_config_inport(&pdev->dev, false);
>   
>   	smb_unregister_sink(drvdata);
>   




More information about the linux-arm-kernel mailing list