Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Junzhong Pan" <panjunzhong@linux.spacemit.com>
Cc: devicetree@vger.kernel.org, linux-usb@vger.kernel.org,
	conor+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 2/8] usb: chipidea: usb2: use devm_clk_get_optional_enabled()
Date: Fri, 09 Oct 2026 07:36:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-165013@kernel.org> (raw)
In-Reply-To: <20261009-b4-spacemit-k1-usb2-v4-2-2d98e5324d9a@linux.spacemit.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] usb: chipidea: redundant struct and memory allocation for ci_hdrc_usb2_priv
--

commit a1804027a297ffe7216fa43c74cdb463efa0f512
Author: Junzhong Pan <panjunzhong@linux.spacemit.com>

usb: chipidea: usb2: use devm_clk_get_optional_enabled()

Convert devm_clk_get_optional() and clk_prepare_enable() into a single
call devm_clk_get_optional_enabled().

> diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> index 8ffa1e95d8e86..9cef902f36b37 100644
> --- a/drivers/usb/chipidea/ci_hdrc_usb2.c
> +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> @@ -20,7 +20,6 @@
>  
>  struct ci_hdrc_usb2_priv {
>  	struct platform_device	*ci_pdev;
> -	struct clk		*clk;
>  };

[Severity: Low]
Does this code still need a wrapper struct now that it only contains a
single pointer?

[ ... ]

> @@ -70,15 +70,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
>  	if (!priv)
>  		return -ENOMEM;
>  
> -	priv->clk = devm_clk_get_optional(dev, NULL);
> -	if (IS_ERR(priv->clk))
> -		return PTR_ERR(priv->clk);
> -
> -	ret = clk_prepare_enable(priv->clk);
> -	if (ret) {
> -		dev_err(dev, "failed to enable the clock: %d\n", ret);
> -		return ret;
> -	}
> +	clk = devm_clk_get_optional_enabled(dev, NULL);
> +	if (IS_ERR(clk))
> +		return dev_err_probe(dev, PTR_ERR(clk),
> +				     "failed to get or enable the clock\n");

[Severity: Low]
Could this devm_kzalloc() for the priv struct be eliminated? Since the clk
pointer was removed from ci_hdrc_usb2_priv, the single ci_pdev pointer
could be stored directly using platform_set_drvdata() in
ci_hdrc_usb2_probe(), avoiding the unnecessary heap allocation.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=2

  reply	other threads:[~2026-10-09  7:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
2026-10-09  7:30 ` [PATCH v4 1/8] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 2/8] usb: chipidea: usb2: use devm_clk_get_optional_enabled() Junzhong Pan
2026-10-09  7:36   ` sashiko-bot [this message]
2026-10-09  7:30 ` [PATCH v4 3/8] usb: chipidea: usb2: add optional reset support Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 4/8] usb: chipidea: usb2: add SpacemiT K1 support Junzhong Pan
2026-10-09  7:34   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 5/8] riscv: dts: spacemit: add USB2.0 controller nodes for K1 Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 6/8] riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3 Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 7/8] riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2 Junzhong Pan
2026-10-09  7:35   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 8/8] riscv: defconfig: enable ChipIdea USB controller support Junzhong Pan
2026-10-09  7:38   ` sashiko-bot

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=sashiko-outbox-165013@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=panjunzhong@linux.spacemit.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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