From: Andrew Lunn <andrew@lunn.ch>
To: Xiangwu Lai <laixiangwu@cmss.chinamobile.com>
Cc: chester.a.unal@arinc9.com, daniel@makrotopia.org,
olteanv@gmail.com, sean.wang@mediatek.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: dsa: mt7530: fix regulator leak in mt7530_setup()
Date: Thu, 19 Nov 2026 00:36:27 +0100 [thread overview]
Message-ID: <7c6bcbbe-bcca-4294-a54c-320b26a9d3da@lunn.ch> (raw)
In-Reply-To: <20261118014114.1855-1-laixiangwu@cmss.chinamobile.com>
> Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
Does this bother anybody?
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> +err_disable_core_pwr:
> + regulator_disable(priv->core_pwr);
> + return ret;
> +
> +err_powers:
> + if (priv->id == ID_MT7530) {
> + regulator_disable(priv->io_pwr);
> + regulator_disable(priv->core_pwr);
> + }
> + return ret;
It is unusual to have two different goto labels with return. Normally
cleanup is structured similar to the code which went wrong.
So something like:
> +err_powers:
> + if (priv->id == ID_MT7530)
> + regulator_disable(priv->io_pwr);
> +err_disable_core_pwr:
> + if (priv->id == ID_MT7530)
> + regulator_disable(priv->core_pwr);
> + return ret;
Andrew
---
pw-bot: cr
prev parent reply other threads:[~2026-11-18 23:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 1:41 Xiangwu Lai
2026-11-18 1:42 ` netdev-bot+sinfo
2026-11-18 23:36 ` Andrew Lunn [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=7c6bcbbe-bcca-4294-a54c-320b26a9d3da@lunn.ch \
--to=andrew@lunn.ch \
--cc=chester.a.unal@arinc9.com \
--cc=daniel@makrotopia.org \
--cc=laixiangwu@cmss.chinamobile.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=sean.wang@mediatek.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
all inboxes | Powered by JetHome®