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: 624726 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: