mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Detlev Casanova	 <detlev.casanova@collabora.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Heiko Stuebner	 <heiko@sntech.de>,
	Hans Verkuil <hverkuil@kernel.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	 linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] media: rkvdec: Fix an error handling path in rkvdec_probe()
Date: Mon, 28 Jul 2025 18:50:36 -0400	[thread overview]
Message-ID: <0a8391cb368653b91ea73a51e2c0dee35cceb128.camel@collabora.com> (raw)
In-Reply-To: <b69c20783a7b6f7964ab636679d3da80fc48372e.1753610517.git.christophe.jaillet@wanadoo.fr>

[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]

Hi,

Le dimanche 27 juillet 2025 à 12:02 +0200, Christophe JAILLET a écrit :
> If an error occurs after a successful iommu_paging_domain_alloc() call, it
> should be undone by a corresponding iommu_domain_free() call, as already
> done in the remove function.
> 
> Fixes: ff8c5622f9f7 ("media: rkvdec: Restore iommu addresses on errors")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only
> ---
>  drivers/media/platform/rockchip/rkvdec/rkvdec.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> index d707088ec0dc..eb0d41f85d89 100644
> --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
> @@ -1169,15 +1169,17 @@ static int rkvdec_probe(struct platform_device *pdev)
>  	vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (irq <= 0)
> -		return -ENXIO;
> +	if (irq <= 0) {
> +		ret = -ENXIO;
> +		goto err_free_domain;
> +	}
>  
>  	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
>  					rkvdec_irq_handler, IRQF_ONESHOT,
>  					dev_name(&pdev->dev), rkvdec);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Could not request vdec IRQ\n");
> -		return ret;
> +		goto err_free_domain;
>  	}
>  
>  	pm_runtime_set_autosuspend_delay(&pdev->dev, 100);

Have you considered moving the allocation of the domain right above the above
line instead ? The empty domain can't possibly be used unless the probe have
fully completed.

Nicolas

> @@ -1193,6 +1195,9 @@ static int rkvdec_probe(struct platform_device *pdev)
>  err_disable_runtime_pm:
>  	pm_runtime_dont_use_autosuspend(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> +err_free_domain:
> +	if (rkvdec->empty_domain)
> +		iommu_domain_free(rkvdec->empty_domain);
>  	return ret;
>  }
>  

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2025-07-28 22:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-27 10:02 Christophe JAILLET
2025-07-28 22:50 ` Nicolas Dufresne [this message]
2025-07-29 19:33   ` Christophe JAILLET
2025-07-29 20:28     ` Nicolas Dufresne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a8391cb368653b91ea73a51e2c0dee35cceb128.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=detlev.casanova@collabora.com \
    --cc=heiko@sntech.de \
    --cc=hverkuil@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®