mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wentao Liang" <vulab@iscas.ac.cn>, alexandre.belloni@bootlin.com
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	vigneshr@ti.com, claudiu.beznea@tuxon.dev,
	stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	nicolas.ferre@microchip.com, bbrezillon@kernel.org,
	miquel.raynal@bootlin.com, richard@nod.at
Subject: Re: [PATCH] mtd: rawnand: atmel: Fix HSMC clock leak in legacy controller init
Date: Thu, 17 Sep 2026 10:38:55 +0000	[thread overview]
Message-ID: <20260917103855.934A81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260917102804.2146887-1-vulab@iscas.ac.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] mtd: backward goto in error handling path violates kernel style
--

commit aad96ec48f9b270598811f4065826c70f378687c
Author: Wentao Liang <vulab@iscas.ac.cn>

mtd: rawnand: atmel: Fix HSMC clock leak in legacy controller init

atmel_hsmc_nand_controller_legacy_init() takes a reference to the
HSMC clock with of_clk_get() and enables it, but the error paths
that follow only release the device node, so both the reference and
the enable are leaked whenever the controller cannot be fully
initialized. Add an err_disable_clk path that disables and releases
the clock before jumping to the existing out path.

> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
> index 8a19408abb635..bafc8c995e376 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
[ ... ]
> @@ -2260,6 +2261,12 @@ atmel_hsmc_nand_controller_legacy_init(struct atmel_hsmc_nand_controller *nc)
>  	of_node_put(nfc_np);
>  
>  	return ret;
> +
> +err_disable_clk:
> +	clk_disable_unprepare(nc->clk);
> +	clk_put(nc->clk);
> +
> +	goto out;

[Severity: Low]
Does this backward jump to the out label introduce a regression in standard
kernel conventions for error handling?

While functionally correct, jumping backwards instead of structuring cascading
error labels so that the success path exits or jumps forward over the error
handling blocks introduces non-standard control flow in this function.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260917102804.2146887-1-vulab@iscas.ac.cn?part=1

      reply	other threads:[~2026-09-17 10:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 10:28 Wentao Liang
2026-09-17 10:38 ` sashiko-bot [this message]

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=20260917103855.934A81F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=richard@nod.at \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=vigneshr@ti.com \
    --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

all inboxes | Powered by JetHome®