[2/2] Revert "regulator: core: fix kobject release warning and memory leak in regulator_register()"
Message ID | d7361cf5c6bfc78f519149554eadad1d5ef5e76f.1694985959.git.mirq-linux@rere.qmqm.pl |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2328629vqi; Sun, 17 Sep 2023 15:41:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuWogiK+RNFkQR2WgUqvRinVUm2q9eNIaDNAtbxhAftmMgCaMdOIW9GUMKS37x8OSX22Wr X-Received: by 2002:a05:6a20:9148:b0:154:b4cb:2e61 with SMTP id x8-20020a056a20914800b00154b4cb2e61mr7179954pzc.60.1694990512226; Sun, 17 Sep 2023 15:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694990512; cv=none; d=google.com; s=arc-20160816; b=attxNNG++0XO3IJ6T0DJGY2jIkrCBBcKH9J7W40pLlepEsEVvW7i5xzOf9ifSJcCum B4IdhGVRAjOe/CAZEl4ENeU6WFobhOd4QMEBLmV4Oq0kDvTn1Ta53X2dXHw9BIuvJjF0 R/C7ptFpxxRa21pe6sfWiHOlMF2SmD6eNit0EzabtLpQIf62NFPTFUQZPzn4na9ubQNv qAKrI2tOTrneg0l+A+i+S9Pi5dNug59G7IkDfReMSdmqwbTBG3oi8NbO3nUerwyGWX1D u4EaDSHMb/tJDJDgpOjGdi/880W4HNSC0P1Abuy5Cy2etelIEIroN52f5jCuvnixDHEw 6E7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:date :dkim-signature; bh=AkkLwN5s/fABvZ6JGIiUVvu2EguxMp5CtxxwUm/7GeE=; fh=q0TLCQSNPOFC/px7VHF1+KvjmoORcZngC8nAdCL3zfM=; b=J1dov89bPzE4iEuANbIBRUeE2bhsUTiqG14cKleUFwVjYTG2HNwgfME3qyn6O8KQJ5 PSVYMNCv4ljc1vpEEutB31bQ+vPTGAVr1+ucnlURxTA9goiVLuGcENOp4XCtQFoj3JDH tPJRTTZuW96IpBn5p/DT8btIFhV4C69ZC7EkZkZYcMMLNyIWAoRUegaVM1O1i4nqrSZj cge943zD4oR1C8+uuhHwAmKBRyvNN0MTks8nPhKSjH361egce2hofCWHu41e3DusXyKL aWvCXmUhrUOHGGJaWnixNk8ZVspe+9sWyr1y+wi7cZ6JSO5XlPKxfBD5Tk4cnjIOSAxM ZTXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=cFvaDmHr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id f22-20020a633816000000b0057807cdc6c0si5904577pga.710.2023.09.17.15.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 15:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b=cFvaDmHr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2AE1881DF749; Sun, 17 Sep 2023 14:45:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238442AbjIQVfm (ORCPT <rfc822;kernel.ruili@gmail.com> + 28 others); Sun, 17 Sep 2023 17:35:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231883AbjIQVfX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 17 Sep 2023 17:35:23 -0400 Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 790D5F1 for <linux-kernel@vger.kernel.org>; Sun, 17 Sep 2023 14:35:17 -0700 (PDT) Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4Rph6W0lPXzHx; Sun, 17 Sep 2023 23:35:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1694986515; bh=UIbXDMty5LFR94K/w6jaxWU7ApJpMH2RmAPQ/Wr0MaQ=; h=Date:In-Reply-To:References:Subject:From:To:Cc:From; b=cFvaDmHr4ZS3Nst/gI9ZxNLOkq1X7TIyx4n2b16SjWNCE5FoYzDUN49o2BMA5RvY7 M0cvNgGrvH8Q41rAp9LWnIlAq1cM1HiU1XbROidxh/J2Tc+oaFF4y2QDhDP0iAhzjf 0vIBUr+nvU9McUg5LxNcrp5PdBpuhBQwRfRtVgaUTzV+J5i8tIP6yhnU2KvZiRseHd RQhHQWOYCfWGyogNqeqv0HvjYYWloA+jAngELqGs8wFhVlKHkNO2sGDp8heAx/fp9Z DCoVtVhuq+aiXaWXYGlqHyrJdnh2xe1Ghe0G3pP/2iKQ6pO248GZ703l1+Rk4LQyUM eyIg7dxE7X/Wg== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at mail Date: Sun, 17 Sep 2023 23:35:14 +0200 Message-Id: <d7361cf5c6bfc78f519149554eadad1d5ef5e76f.1694985959.git.mirq-linux@rere.qmqm.pl> In-Reply-To: <cover.1694985959.git.mirq-linux@rere.qmqm.pl> References: <cover.1694985959.git.mirq-linux@rere.qmqm.pl> Subject: [PATCH 2/2] Revert "regulator: core: fix kobject release warning and memory leak in regulator_register()" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= <mirq-linux@rere.qmqm.pl> To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org> Cc: linux-kernel@vger.kernel.org, Vladimir Zapolskiy <vz@mleia.com>, Zeng Heng <zengheng4@huawei.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 17 Sep 2023 14:45:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777326371630536965 X-GMAIL-MSGID: 1777326371630536965 |
Series |
regulator/core: A quick fix for struct device handling
|
|
Commit Message
Michał Mirosław
Sept. 17, 2023, 9:35 p.m. UTC
This reverts commit 5f4b204b6b8153923d5be8002c5f7082985d153f.
Since rdev->dev now has a release() callback, the proper way of freeing
the initialized device can be restored.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/regulator/core.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
Comments
On Sun, Sep 17, 2023 at 11:35:14PM +0200, Michał Mirosław wrote: > This reverts commit 5f4b204b6b8153923d5be8002c5f7082985d153f. > > Since rdev->dev now has a release() callback, the proper way of freeing > the initialized device can be restored. Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone. Please include human readable descriptions of things like commits and issues being discussed in e-mail in your mails, this makes them much easier for humans to read especially when they have no internet access. I do frequently catch up on my mail on flights or while otherwise travelling so this is even more pressing for me than just being about making things a bit easier to read.
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 2f6ee5527cb0..0994caa5ad5c 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5724,15 +5724,11 @@ regulator_register(struct device *dev, mutex_lock(®ulator_list_mutex); regulator_ena_gpio_free(rdev); mutex_unlock(®ulator_list_mutex); - put_device(&rdev->dev); - rdev = NULL; clean: if (dangling_of_gpiod) gpiod_put(config->ena_gpiod); - if (rdev && rdev->dev.of_node) - of_node_put(rdev->dev.of_node); - kfree(rdev); kfree(config); + put_device(&rdev->dev); rinse: if (dangling_cfg_gpiod) gpiod_put(cfg->ena_gpiod);