linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Haotian Zhang <vulab@iscas.ac.cn>
Cc: herve.codina@bootlin.com, gregkh@linuxfoundation.org,
	 linux-renesas-soc@vger.kernel.org, linux-usb@vger.kernel.org,
	 linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: renesas_usbf: Handle devm_pm_runtime_enable() errors
Date: Mon, 24 Nov 2025 14:15:14 +0100	[thread overview]
Message-ID: <CAMuHMdUSPSjh4nQ1B6NJdYZw3qW30Tx5zci6vy_9Hy6BS64FWQ@mail.gmail.com> (raw)
In-Reply-To: <20251124022215.1619-1-vulab@iscas.ac.cn>

Hi Haotian,

On Mon, 24 Nov 2025 at 03:24, Haotian Zhang <vulab@iscas.ac.cn> wrote:
> devm_pm_runtime_enable() can fail due to memory allocation.
> The current code ignores its return value, potentially causing
> pm_runtime_resume_and_get() to operate on uninitialized runtime
> PM state.
>
> Check the return value of devm_pm_runtime_enable() and return on failure.
>
> Fixes: 3e6e14ffdea4 ("usb: gadget: udc: add Renesas RZ/N1 USBF controller support")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>

Thanks for your patch!

> --- a/drivers/usb/gadget/udc/renesas_usbf.c
> +++ b/drivers/usb/gadget/udc/renesas_usbf.c
> @@ -3262,7 +3262,9 @@ static int usbf_probe(struct platform_device *pdev)
>         if (IS_ERR(udc->regs))
>                 return PTR_ERR(udc->regs);
>
> -       devm_pm_runtime_enable(&pdev->dev);
> +       ret = devm_pm_runtime_enable(&pdev->dev);
> +       if (ret)
> +               return ret;

Perhaps insert a blank line here?

>         ret = pm_runtime_resume_and_get(&pdev->dev);
>         if (ret < 0)
>                 return ret;

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  parent reply	other threads:[~2025-11-24 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-24  2:22 [PATCH] usb: gadget: renesas_usbf: Handle devm_pm_runtime_enable() errors Haotian Zhang
2025-11-24  7:43 ` Herve Codina
2025-11-24 13:15 ` Geert Uytterhoeven [this message]
2025-11-26 12:47   ` Andy Shevchenko

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=CAMuHMdUSPSjh4nQ1B6NJdYZw3qW30Tx5zci6vy_9Hy6BS64FWQ@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=herve.codina@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=vulab@iscas.ac.cn \
    /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;
as well as URLs for NNTP newsgroup(s).