From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: mchehab@kernel.org, ezequiel@vanguardiasur.com.ar,
hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com,
"Xavier Roumegue (OSS)" <xavier.roumegue@oss.nxp.com>
Cc: linux-media@vger.kernel.org, kernel test robot <lkp@intel.com>,
Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH] media: dw100: Add a missing unwind goto in dw100_probe()
Date: Tue, 03 Jan 2023 14:48:28 +0100 [thread overview]
Message-ID: <6400080.K2JlShyGXD@steina-w> (raw)
In-Reply-To: <42a8016a-8922-236d-30a7-9b12b53a9bb9@oss.nxp.com>
Hi Xavier,
Am Dienstag, 3. Januar 2023, 14:35:35 CET schrieb Xavier Roumegue (OSS):
> Hi Alexander,
>
> On 1/3/23 12:01, Alexander Stein wrote:
> > Hi,
> >
> > Am Dienstag, 3. Januar 2023, 11:55:34 CET schrieb Xavier Roumegue (OSS):
> >> From: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
> >>
> >> In case the IRQ allocation returns an error in dw100_probe(), the pm
> >> runtime is not disabled before to return.
> >>
> >> Add the missing unwind goto on the error handling path of the IRQ
> >> allocation request.
> >>
> >> Reported-by: kernel test robot <lkp@intel.com>
> >> Reported-by: Dan Carpenter <error27@gmail.com>
> >> Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
> >> ---
> >>
> >> drivers/media/platform/nxp/dw100/dw100.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/media/platform/nxp/dw100/dw100.c
> >> b/drivers/media/platform/nxp/dw100/dw100.c index
> >> f6d48c36f386..189d60cd5ed1
> >> 100644
> >> --- a/drivers/media/platform/nxp/dw100/dw100.c
> >> +++ b/drivers/media/platform/nxp/dw100/dw100.c
> >> @@ -1571,7 +1571,7 @@ static int dw100_probe(struct platform_device
> >> *pdev)
> >>
> >> dev_name(&pdev->dev), dw_dev);
> >>
> >> if (ret < 0) {
> >>
> >> dev_err(&pdev->dev, "Failed to request irq: %d\n", ret);
> >>
> >> - return ret;
> >> + goto err_pm;
> >>
> >> }
> >>
> >> ret = v4l2_device_register(&pdev->dev, &dw_dev->v4l2_dev);
> >
> > Doesn't it make more sense to request/allocate the IRQ (and other
> > resources) before enabling runtime PM?
>
> I would say this does as much sense as the other way around, as soon as
> something wrong happens, you have to restore things as it was prior to enter
> your routine. The most optimal function call ordering should depend on the
> failing occurrence likelihood of each individual function.
> On the probe path, I assume none of the functions are expected to fail.
> But I understand one could argue differently.
-EPROBE_DEFER teached me otherwise ;-) What I actually wanted to highlight is
that calling the devm_* functions first, reduces the cleanup path for the
following setup calls.
> So for the time being, this oneliner patch addresses the issue reported by
> the robot.
Sure, on the other hand it's less complex if you can just return in an error
path.
Best regards,
Alexander
next prev parent reply other threads:[~2023-01-03 13:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 10:55 [PATCH] media: dw100: Add a missing unwind goto in dw100_probe() Xavier Roumegue (OSS)
2023-01-03 11:01 ` Alexander Stein
2023-01-03 13:35 ` Xavier Roumegue (OSS)
2023-01-03 13:48 ` Alexander Stein [this message]
2023-01-03 13:52 ` Laurent Pinchart
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=6400080.K2JlShyGXD@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=error27@gmail.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mchehab@kernel.org \
--cc=xavier.roumegue@oss.nxp.com \
/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