Article View: linux.kernel.netdev
Article #18813Re: [PATCH] net: dsa: mt7530: fix regulator leak in mt7530_setup()
From: Andrew Lunn
Date: Wed, 18 Nov 2026 23:36
Date: Wed, 18 Nov 2026 23:36
36 lines
8908 bytes
8908 bytes
> 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
Technical Details
Message-ID:
<7c6bcbbe-bcca-4294-a54c-320b26a9d3da@lunn.ch>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366523-linux-kernel-netdev=dewy.ruReferences:
<20261118014114.1855-1-laixiangwu@cmss.chinamobile.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366523-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] net: dsa: mt7530: fix regulator leak in mt7530_setup() Date: Thu, 19 Nov 2026 00:36:27 +0100 Organization: Usenet Network Message-ID: <7c6bcbbe-bcca-4294-a54c-320b26a9d3da@lunn.ch> References: <20261118014114.1855-1-laixiangwu@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2730183"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:2ahB2xQ8Px4DReMAGp/MEEk4nk0= sha256:+E8HXq4Q33EX4NSBin4VcYJXhBA36ObE/GpGB46nWNs= sha1:48kWMQtkcUipiLYsZ5oMmaWn4aQ= sha256:sqiErbnRI3jgO2R16QjS5KL1B3JGQ26oRzbhE71xi/U= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id CB4421153AE; Thu, 19 Nov 2026 02:37:04 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uj-LS4PWsoCB; Thu, 19 Nov 2026 02:36:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366523-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id ACB2711541F; Thu, 19 Nov 2026 02:36:50 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 4B62B245066; Wed, 18 Nov 2026 23:36:47 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795045005; b=AeQZZ/1gWoU7WjX3jNEmrVcuYCgA+JApdlstNiAtYuGIYKEb3usKTQfMMYwMSJ6ygA/Y ga4hI/HmIMawbi9JynzSukexO3gs3DviQy5j8pK4g/wM63P6FJiMbn2OA6erNBF/topzl ivmHLdSFsGgH5Ls8No8SaFUTqlaWjp7emZZGmScF32MpIgvor4bxxn1EYnbXhayi6yrD2 RueWK71mU+1ttg7Py8uMajnUJptVe+j5DIKTOvqS7mpQXt9A76O1hmA6Okus9wkLQVdCQ PyNRmKWMtHlGHMQFn9Z+KnFKuc9o5cr1pdrF+2upXs3MCySr2c6zX+9iSUJhq6TENpQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795045005; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=UzULi3pDyt9yA1wkNNfY/xIv0rCm9wBQxGgbAXP0KBw=; b=erJHQ/2FEbuxoQ/bDNtAsiWa0pKRNGtYClL3FHbV8InQ4kvuFtqqNm6GaD/MzWT7hWjs kpjXiRfhwYZ2siFgHb6Wvb69hbr+x8DUm2hGgIBzTPyq1O3YTGCraf+J/UmZYQJ+JMztF 95dpF/HnB0OGqcY2WKK8tRUivzKnMk64XfRUY4bsq0FMXrOLaYVghsaWGVblwdrIuie3s HtMwZ3lm7DIrMtQ4UDZkxCauDcnK3RiAUXpNgDcAFKX0dBW0ZJuLvycGNpIISAwN9iMFt vHPEQJl/CZBZR4YuAm2HY3bhHCHNIM9ksRrBhVHToRaHqmOJdvcP3+Iq7eCFpBXmO0w== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=5uZ6z84R; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 795D260A2602; Wed, 18 Nov 2026 23:36:45 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=5uZ6z84R X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795045004; b=OD7/RqzbMdnWin6tgYdef+6BHiBu1oADWer1Z81Me9BnFU/Mc1fHchYXBK4zi/LmEN7h GdVVPLXF6mN29PlNL3PKLSKS8HSGwbw3o5uRcSExG+qQZ3cDCqNJfh930xlLjOvcGr1zs WydVuu+RdDzVzquF7nSuG8G13+uG0QJUwLSPqE3mevJH8ZUOB2zuLXu8ggJ1cdbv6qevU aLK9GD24+Q4utZlRwwqY20TaVUbw7/YJdlHMqjs0PdlTI291mtKbbeue04U/XrzQvM8dw 9mLqi82807PeoEshKFS9ZnwaiJGvSMfybb0FbtBLfwTM57ES6+m44ldq/szXag3B4+g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795045004; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=UzULi3pDyt9yA1wkNNfY/xIv0rCm9wBQxGgbAXP0KBw=; b=MCJcfsTBkqgjAhbKr97p8WFr0C3hCSOOlHUUVTwta4DzqCtw3wsKg+WY0fSNCZdZr+TI PdTfDMubuAtoiGqTz/4cRp1/zKa+SUFOGAgq15qrDmXDQZjp+Xt0g8KLfR2ucRtmCdpzY mRILyHU7PhpPvykzp+6Fs0KwzqDA6aQtQFlWKTJr39Gl6L0qWv6vlDsshoNGrlwbOkfB6 4DJ6YI9Ijz0Bz9q2cXV0a5a2wHvD0tKV5QE8M2v16K2NK949NqgrvIuYlXhFFurW6ZVW9 J16Qcz4707uAMyI4iZp1ZeG1iND+o4IGj9sZaB3Mttk9ltI+Z2CO71kLNwu/NKPkPvw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=5uZ6z84R; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47D48606A31C; Wed, 18 Nov 2026 23:36:44 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47D48606A31C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=UzULi3pDyt9yA1wkNNfY/xIv0rCm9wBQxGgbAXP0KBw=; b=5uZ6z84RPsLSQVVFdYB1pcAc3j tH8ohlD4j0LBFv0zoJQvwi2ZiAC6t6h+1zMC2Dhw60hd4FS3MjQ7BvlUzoDCNEiiOgMJ0H4A+SHlf EuEQLK5L3vumrfdq9pAZbEhv9K6aRES65SnGP83UgtEHU8Av6H4KnPOJrcg/ZH5TAqTo=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xTpCV-00HWlx-VF; Thu, 19 Nov 2026 00:36:27 +0100 X-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 X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261118014114.1855-1-laixiangwu@cmss.chinamobile.com>