From patchwork Mon Nov 14 17:44:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13042651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEDABC4332F for ; Mon, 14 Nov 2022 17:44:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237423AbiKNRoz (ORCPT ); Mon, 14 Nov 2022 12:44:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237395AbiKNRoy (ORCPT ); Mon, 14 Nov 2022 12:44:54 -0500 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D7125C0; Mon, 14 Nov 2022 09:44:53 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 690E75C00ED; Mon, 14 Nov 2022 12:44:53 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 14 Nov 2022 12:44:53 -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:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm1; t=1668447893; x=1668534293; bh=vMxy/5Ep6z 8xTyah49JP7LX4W4hXdf9xwgHuikKY72M=; b=gLtoIFASX/fLQRLrI/h9jTax7p O/KAJ5C/fsKgbWyMcl7cxPio9Xs6o1i+kFeireANe2+loloq+rE45tpRhrLJl+8t nseMb0RGXgBToUHBg6vwnLxt3WfEQW47oqT0j8sU8od4WwcXGASUDsPDpPlU9Rpg w7sxkssw52zxtULaVVcgJsply9Mtp5ReJAPPZ7tPopQzd98vEibRNrxX5/kH2P1V rc+XNeL04umtrtkIl5l8eSjbuHHOgX7gRLz7yTyRZ6hIMQKb3U/xtVWgQCiYIoN7 43Rj41gh/zNHGJ1HphUsgX7JWuWHkkUmC1ajBFjsTG21P6ImhBIH2Y/MlYfw== 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:message-id :mime-version: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= 1668447893; x=1668534293; bh=vMxy/5Ep6z8xTyah49JP7LX4W4hXdf9xwgH uikKY72M=; b=cJhN3xTuNzHHKgf96QzXN+EEIlg/JxLrzBGuuJPUk0ZTrmsbIW+ koz/jtenzfIifmLKnL9DxZviRsZhehyMvcNapMykOPONVeuQ71foudGItvXLMpQZ DFK55X5D2+Xbi0MB1GeK55GSmvhM3GAGjoOAVJYmJIvqgv2v7Ft4oRPy39hw4RZb mEjclqv0eOGATCwkoP7VlOjWcIwHdGeGaR7s+q79sAvDgNNHQS88ph0AjkOMJxh7 CXZPHNaUv2cuXMv6zREocLcbR3a/XQ9h2xKe6A6mZqbCUp3JfYLrnzEVSuVMa7qs gG+6JSfHYlHixg4YK3OtDf7oVk0urHLX96Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgedvgdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epleduffeiheeuvedtffevtdeuleeljeduudfgtedtvefhfeffvdfghfejhefgleelnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvghnse hsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Nov 2022 12:44:52 -0500 (EST) From: Sven Peter To: Heikki Krogerus , Greg Kroah-Hartman Cc: Sven Peter , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] usb: typec: tipd: Cleanup resources if devm_tps6598_psy_register fails Date: Mon, 14 Nov 2022 18:44:46 +0100 Message-Id: <20221114174449.34634-1-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org We can't just return if devm_tps6598_psy_register fails since previous resources are not devres managed and have yet to be cleaned up. Fixes: 10eb0b6ac63a ("usb: typec: tps6598x: Export some power supply properties") Signed-off-by: Sven Peter Reviewed-by: Heikki Krogerus --- 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 748ff4f6b5f6..ebc786d728e2 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -827,7 +827,7 @@ static int tps6598x_probe(struct i2c_client *client) ret = devm_tps6598_psy_register(tps); if (ret) - return ret; + goto err_role_put; tps->port = typec_register_port(&client->dev, &typec_cap); if (IS_ERR(tps->port)) { From patchwork Mon Nov 14 17:44:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13042652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D7B8C43217 for ; Mon, 14 Nov 2022 17:44:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237395AbiKNRo5 (ORCPT ); Mon, 14 Nov 2022 12:44:57 -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 ); 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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgedvgdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnhepjeeiheehkeegvdejhfevkeejgfdutdefhfethedtieffleekieeuudefleekjeeg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Nov 2022 12:44:53 -0500 (EST) From: Sven Peter To: Heikki Krogerus , Greg Kroah-Hartman Cc: Sven Peter , 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 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 Reviewed-by: Heikki Krogerus --- 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; From patchwork Mon Nov 14 17:44:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13042653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1764DC433FE for ; Mon, 14 Nov 2022 17:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237512AbiKNRo6 (ORCPT ); Mon, 14 Nov 2022 12:44:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237487AbiKNRo5 (ORCPT ); Mon, 14 Nov 2022 12:44:57 -0500 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3465190; Mon, 14 Nov 2022 09:44:56 -0800 (PST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CD2135C00ED; Mon, 14 Nov 2022 12:44:55 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 14 Nov 2022 12:44:55 -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=1668447895; x= 1668534295; bh=HV91cHyyAtejZdn17gJSrjXPYFuVs8vpuK6kjSyLhQQ=; b=a c6uxn8/5bNJI7SH1jDcovjMrmWa4H6xnKx7YpwXRxb6GJ33zh1ze4EyDPhalCSVp LY0uB4Sq2hi5rh3pB120Zp1ScfVpt0U+ySroI63Cowt46Y/q/I1X7Q1NIopK+Yk1 5T7i3OzicEDVrcOzksRCn8l1En/6EVVVhEfG78nw/CCByZLrTiMLoiemnM/4B9yp J8Rw9jbh9T/coDAufVY9zwHJkZUjckGJNjXVoOfhn5CJductA2u7PWApPM5BqYfv O7UstElhacVW+i6lt4LJKHqdvXatCtho2lXJm7//ilBXtNk/5uYmtyqF5Zs/upty 2Gav7VclqFyp5RvLemM5g== 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=1668447895; x=1668534295; bh=HV91cHyyAtejZ dn17gJSrjXPYFuVs8vpuK6kjSyLhQQ=; b=B7jphw5LCpK5qz0vfAE/bzi+h+9nb LkCAM0CldqkwWDVJfrBM/IUZkV6e07x7nED9YD+51dcYxiKmiJWm/WsuH8qMOtkY 7OAD2RK4jZZ4N1u/gqjgbZUWma3peyMN2ANmDkhfhJBDTj72NN1HLjrtFjabqvRI OGk/R0MRjz7L+V77W9eQsV3LYwLS31VpkFN7EaUgRUqCJhXZFDEM11j03xtPHL1n 4cj6eqRLjh38EZQl7HTqeBa0S5T0R4P8oddVtoCegkxYf/B7XFCdXYm4lR/rjyqz AwYWXSYKGPxF0CYfjtsWTLF00mqtsEAVfP8gpHIc6293W635Y5EHNlDCQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgedvgdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnhepjeeiheehkeegvdejhfevkeejgfdutdefhfethedtieffleekieeuudefleekjeeg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Nov 2022 12:44:54 -0500 (EST) From: Sven Peter To: Heikki Krogerus , Greg Kroah-Hartman Cc: Sven Peter , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] usb: typec: tipd: Fix typec_unregister_port error paths Date: Mon, 14 Nov 2022 18:44:48 +0100 Message-Id: <20221114174449.34634-3-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 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org typec_unregister_port is only called for some error paths after typec_register_port was successful. Ensure it's called in all cases. Fixes: 92440202a880 ("usb: typec: tipd: Only update power status on IRQ") Signed-off-by: Sven Peter Reviewed-by: Heikki Krogerus --- drivers/usb/typec/tipd/core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 824e573af570..c35501a92b4d 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -839,7 +839,7 @@ static int tps6598x_probe(struct i2c_client *client) ret = tps6598x_read16(tps, TPS_REG_POWER_STATUS, &tps->pwr_status); if (ret < 0) { dev_err(tps->dev, "failed to read power status: %d\n", ret); - goto err_role_put; + goto err_unregister_port; } ret = tps6598x_connect(tps); if (ret) @@ -852,8 +852,7 @@ static int tps6598x_probe(struct i2c_client *client) dev_name(&client->dev), tps); if (ret) { tps6598x_disconnect(tps, 0); - typec_unregister_port(tps->port); - goto err_role_put; + goto err_unregister_port; } i2c_set_clientdata(client, tps); @@ -861,6 +860,8 @@ static int tps6598x_probe(struct i2c_client *client) return 0; +err_unregister_port: + typec_unregister_port(tps->port); err_role_put: usb_role_switch_put(tps->role_sw); err_fwnode_put: From patchwork Mon Nov 14 17:44:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 13042654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0417AC433FE for ; Mon, 14 Nov 2022 17:45:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237592AbiKNRpE (ORCPT ); Mon, 14 Nov 2022 12:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237435AbiKNRpA (ORCPT ); Mon, 14 Nov 2022 12:45:00 -0500 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0CA190; Mon, 14 Nov 2022 09:44:57 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 03D965C017E; Mon, 14 Nov 2022 12:44:57 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 14 Nov 2022 12:44:57 -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=1668447897; x= 1668534297; bh=oXWjxeEcaEjt1Kdvuu2aUDoMsSbIcDNUNLWbktQ23lI=; b=D eRyyqOgj14aphwVKCfuBEM5pyy+IhOggzAAd+Y4mhitJJgkYuS1R/gMRBj6INEpx i0J5hLhJpkpBnHj3i14QXQlw8fddT3sx7P2W9hBDCTFkOInB6oD4u2yp0YuWFBsT Shrd+PVr0Exx9NMyLZ2bIWzYo+eX+p8CoBgR0gRIBHZWOYKxVzIY5aCcZQmwtzbn s0YyQfr+5XprUNDDvCekyNGvkSJ+ObM/FFAyjz0RLo691IchbKAMNhQW9H0b9bte o6uUhPqTkOg8a3FOAS8k8cFhyh03cceVQ1JSJJm+ICBeWHTr2CLGk8YiVvZfih1c YI/pmPf3DYfCD7eyY8R8g== 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=1668447897; x=1668534297; bh=oXWjxeEcaEjt1 Kdvuu2aUDoMsSbIcDNUNLWbktQ23lI=; b=WJh+2gi3v/W/5OQtkcWaqDFKakPg3 mIA6YRDyAwvOGF34iQ2bBncnhfSgVX0Utu9pik+9P/eRVcccPJZVhGdgYROFrnOE mUXyl2JkD9c++MC/dub20aDgBJ419AuS1/Wh9fZojmEslF4sKh81AcFet4jGqy5f BE9xHwUewUYitRq1KboHuj5JnVrDc0NYswOP5ldkx9V+YO13/QMzJOQ4tL8v/Zsy 5nB0kryK6oRfuSEXpGhn8oTXgEXRT5jZP7FORPuJyVKeAJeWIh/XYwIaVwxKcpbU yjLC9iSx/fFzd5vbSlh0jFQfInRZMANNvw3OIXV7ipL/TRnUO3TGFH4DA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgedvgdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnhepjeeiheehkeegvdejhfevkeejgfdutdefhfethedtieffleekieeuudefleekjeeg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Nov 2022 12:44:55 -0500 (EST) From: Sven Peter To: Heikki Krogerus , Greg Kroah-Hartman Cc: Sven Peter , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] usb: typec: tipd: Move tps6598x_disconnect error path to its own label Date: Mon, 14 Nov 2022 18:44:49 +0100 Message-Id: <20221114174449.34634-4-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 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org While the code currently correctly calls tps6598x_disconnect before jumping to the error cleanup label it's inconsistent compared to all the other cleanup actions and prone to introduce bugs if any more resources are added. Signed-off-by: Sven Peter Reviewed-by: Heikki Krogerus --- drivers/usb/typec/tipd/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index c35501a92b4d..22ff212e05e6 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -850,16 +850,16 @@ static int tps6598x_probe(struct i2c_client *client) irq_handler, IRQF_SHARED | IRQF_ONESHOT, dev_name(&client->dev), tps); - if (ret) { - tps6598x_disconnect(tps, 0); - goto err_unregister_port; - } + if (ret) + goto err_disconnect; i2c_set_clientdata(client, tps); fwnode_handle_put(fwnode); return 0; +err_disconnect: + tps6598x_disconnect(tps, 0); err_unregister_port: typec_unregister_port(tps->port); err_role_put: