Message ID | 20221114174449.34634-2-sven@svenpeter.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2275822wru; Mon, 14 Nov 2022 09:46:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4k72PyLdDBwl4RfGY6Y/K4tX1OJJMSiIv2OfsurVz5gRHu1gS+rrsLuQhGChAum0h5ciTT X-Received: by 2002:a17:906:5f8d:b0:7ad:917b:61ec with SMTP id a13-20020a1709065f8d00b007ad917b61ecmr11136984eju.513.1668448016319; Mon, 14 Nov 2022 09:46:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668448016; cv=none; d=google.com; s=arc-20160816; b=tSVoRay2qz0l8Q6n4Z0JpO0GKI/IqF5vpfD5WnNeFqrTPdIzXXTsmoU8uWbfIo6tyK OouqflF4VsUUKel2G5L1xrshH175qgavmD49/AYX+I3jd4Ia6VuKQx98eDyhwh8gXfDC fCLV7k6bks/BV54z5I6juqlHLrkOJPDAl37rkImatYuIapzurMsnTHudNYC1p1UPCQpM 86NanPHNAUM+COE7MWHU4nolmapziIJRoikbwIAkCDC8f/edajA+9R1mUR+wdel11sqk zXJw2PPOihPQ2lDgEODYR5ZV/gS054o1zrdVk5spiLDlh8Bpqgkh4wOFsfI2r1esyhMB b+lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=ePEQ+K9udupnlN1ckTjNp1CUO4deTP+rgDBrWOphwU0=; b=cSaGbxgx2icfw34EkqBnefZU9ADsMaizWukdog6Fi0FbMFfC2ZU9Ura8OgIlKm1CNB As6LGGqJuKtHfjpTv3jfErW9KcAvjdxht4iGdxKjaUsRfKOSc68ZXVlWUcWkNzpYRQ3k +jijvi9nr/hSy/T/Y2klku2g+edD6B6IRIvmBamz56bXx/9ulFcfKh+/v8I0XB3l1mIB DfMs8MTxJHfB4JvJjgnjsqcWU3RCiCehS8fd94Kk9ZmnZBJHoFJRrTtWq89Ib89Jlu33 JtAaSoTeAzt+I1Ho7KLJg9ziSuCVvrgTOQSGeiT0coP44z1c+pPcxK5t6ZKK+aHfGBd0 MBsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=T4UjzoNT; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=oj1FN3pZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a0564021e9200b00458985e9d19si11360474edf.632.2022.11.14.09.46.32; Mon, 14 Nov 2022 09:46:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm1 header.b=T4UjzoNT; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=oj1FN3pZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237509AbiKNRo6 (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 14 Nov 2022 12:44:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237435AbiKNRo4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 12:44:56 -0500 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49E18190; Mon, 14 Nov 2022 09:44:55 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id B290C5C0184; Mon, 14 Nov 2022 12:44:54 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 14 Nov 2022 12:44:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1668447894; x= 1668534294; bh=ePEQ+K9udupnlN1ckTjNp1CUO4deTP+rgDBrWOphwU0=; b=T 4UjzoNT4HJ5sQ+Qz2kfXVb59W6eDlirUYEkJV5EYo1vm65tYQOgLcNMueBJDjQN+ NMPlHbxsItjZp2NTHkEd7BmquJJ2k6dbQq1l2uyRjC+DCX/iMKvqVYqxa9RDDN7R hr14q1X/jKI/uiHVFdvyUZPYLa2myvno4uLqY3Vkqcw1WfgzMKKRxCwR9Yggkkrr +Yr9F7yfoYzpQGJ9JUapmRo7YhK0wnFAJexlzFDEZ1c0MiIs/Cj6tSH5sx27e6wj ylqkz8ti+U2Fck1HWZGxZFS2MMeWuSifqNaF/kmBY8Ors4y1sJm9zbCynwJOeWL1 yI4L4weXKbPeSW1ai90tg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1668447894; x=1668534294; bh=ePEQ+K9udupnl N1ckTjNp1CUO4deTP+rgDBrWOphwU0=; b=oj1FN3pZslHl+5+KAsxWERCfe9RXP uWYWO9EEvYKe8iDYr547F+K58qWVgROtVUyK/0TuK8nS7tIuwcVxauOfIjkMshmK Xrqx8CCiG8BJuinyTu2S7bAJVAQrATUkiAH2Zb9SNJ2LLJ+OZJeRgOGuEwTjzLGq VN2nIrVZ5TCHGYs/puP+ctDPQyzXWbjImhuV8CI6fBGs98Nxv/260ZRJEJRb3CtL bMeHvtJgu7uiQtpf8l3AO8QL5hbR3g+nq64Dx1BvntGsi3pTmCyQf2sP7FEw49Fj YJMNTX6J6gG+ST7EraY4CSwY68jH4IfhDDbkYGkECZYsx0qFW7aGQ8bCA== X-ME-Sender: <xms:ln5yY4fXrjoMlOu11HjgZ1e14v23EVS-a4kQ_BPi8Yl-CTHdb9VaTA> <xme:ln5yY6MqfxxU1Ht-ivIkqhAKNOFA-etD3FOPmsoKv728TZQsz7Kr5WL-IV8oVnDAP eIE4upnDYVBoxSvyA0> X-ME-Received: <xmr:ln5yY5jxFwKj14Ke9q6hiex0DilhgNRAzalultoyOF2tYFSlFFxEOYZ_YNRb69M6uoqWCe42oZnq11KwZp3FfE7Kd3i5Me8Y0qQ_SvHDa73KTJTvPiPC9Iqyf8EnyQ> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgedvgdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnhepjeeiheehkeegvdejhfevkeejgfdutdefhfethedtieffleekieeuudefleekjeeg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: <xmx:ln5yY9_ZQzQWnJ20vgHbgkicdCzq8ERAVB2rA2GiGNX86IRSza2tSw> <xmx:ln5yY0viea54urPVQoFKdEYSlT4RaOYNb2UmnDm4Mkfgt7ES6tRdpQ> <xmx:ln5yY0FYP_M4h2q1qTiJdF4ouhls48mTJwMlXq34QxMUTnzygvXWOg> <xmx:ln5yYwIlCLniR6gQ0yc-J5wW1m4CMsoptYpSzzML88ZmEheCvvBadg> Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Nov 2022 12:44:53 -0500 (EST) From: Sven Peter <sven@svenpeter.dev> To: Heikki Krogerus <heikki.krogerus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Sven Peter <sven@svenpeter.dev>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] usb: typec: tipd: Fix spurious fwnode_handle_put in error path Date: Mon, 14 Nov 2022 18:44:47 +0100 Message-Id: <20221114174449.34634-2-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20221114174449.34634-1-sven@svenpeter.dev> References: <20221114174449.34634-1-sven@svenpeter.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749494547172511101?= X-GMAIL-MSGID: =?utf-8?q?1749494547172511101?= |
Series |
[1/4] usb: typec: tipd: Cleanup resources if devm_tps6598_psy_register fails
|
|
Commit Message
Sven Peter
Nov. 14, 2022, 5:44 p.m. UTC
The err_role_put error path always calls fwnode_handle_put to release
the fwnode. This path can be reached after probe itself has already
released that fwnode though. Fix that by moving fwnode_handle_put in the
happy path to the very end.
Fixes: 18a6c866bb19 ("usb: typec: tps6598x: Add USB role switching logic")
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
drivers/usb/typec/tipd/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, Nov 14, 2022 at 06:44:47PM +0100, Sven Peter wrote: > The err_role_put error path always calls fwnode_handle_put to release > the fwnode. This path can be reached after probe itself has already > released that fwnode though. Fix that by moving fwnode_handle_put in the > happy path to the very end. > > Fixes: 18a6c866bb19 ("usb: typec: tps6598x: Add USB role switching logic") > Signed-off-by: Sven Peter <sven@svenpeter.dev> This looks like stable material as well. Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/tipd/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c > index ebc786d728e2..824e573af570 100644 > --- a/drivers/usb/typec/tipd/core.c > +++ b/drivers/usb/typec/tipd/core.c > @@ -834,7 +834,6 @@ static int tps6598x_probe(struct i2c_client *client) > ret = PTR_ERR(tps->port); > goto err_role_put; > } > - fwnode_handle_put(fwnode); > > if (tps->status & TPS_STATUS_PLUG_PRESENT) { > ret = tps6598x_read16(tps, TPS_REG_POWER_STATUS, &tps->pwr_status); > @@ -858,6 +857,7 @@ static int tps6598x_probe(struct i2c_client *client) > } > > i2c_set_clientdata(client, tps); > + fwnode_handle_put(fwnode); > > return 0; > thanks,
diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index ebc786d728e2..824e573af570 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -834,7 +834,6 @@ static int tps6598x_probe(struct i2c_client *client) ret = PTR_ERR(tps->port); goto err_role_put; } - fwnode_handle_put(fwnode); if (tps->status & TPS_STATUS_PLUG_PRESENT) { ret = tps6598x_read16(tps, TPS_REG_POWER_STATUS, &tps->pwr_status); @@ -858,6 +857,7 @@ static int tps6598x_probe(struct i2c_client *client) } i2c_set_clientdata(client, tps); + fwnode_handle_put(fwnode); return 0;