From patchwork Mon Aug 12 19:40:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 818692 Received: from 10.mo550.mail-out.ovh.net (10.mo550.mail-out.ovh.net [178.32.96.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D90441607B9 for ; Mon, 12 Aug 2024 22:11:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.32.96.102 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723500667; cv=none; b=DaiqWzoqiDb8GnMtcxoeJbZdUS37mqUiHTADcwVDIH+po0njzxy02ZN5kK3uHlmO+dHE+YytGa9jNcmAg70V/xRz5HXUP3e5iRwXUNfn3dLxxGlp8DKTrL0ZCzS/e6bQX1p5yS11lgMJ13Ca8wKE65DE+nddUt3zXvV1/vKXPMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723500667; c=relaxed/simple; bh=Vny6rVwCTckTsxlHsRJUyiuClvSveUMZim97hZB4hHI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NT/KZ8DECxpxQxBJZDCRHE/W2ZB3ho9bbumtkFVR9DscCtSJ1tUOwNA2FhaLHhJr3SzN9bTH6Gu/G89neJUae5cTSh8DsfmzP+Ha6WJ0FUfO+z0oqDDLP66GA0Dmb0kFv36se0+zUCEeTWfl/jC/lgfeAEIMyUL0jB0yZA7WnGw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=etezian.org; arc=none smtp.client-ip=178.32.96.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etezian.org Received: from director1.ghost.mail-out.ovh.net (unknown [10.108.25.63]) by mo550.mail-out.ovh.net (Postfix) with ESMTP id 4WjPz53wN1z1K92 for ; Mon, 12 Aug 2024 19:41:37 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-bv82q (unknown [10.110.168.204]) by director1.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 208E91FE44; Mon, 12 Aug 2024 19:41:37 +0000 (UTC) Received: from etezian.org ([37.59.142.107]) by ghost-submission-6684bf9d7b-bv82q with ESMTPSA id PQHzBXFlumYxwwUAnZV3Uw (envelope-from ); Mon, 12 Aug 2024 19:41:37 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S0013ee0e8b8-6fb8-4627-9d96-24fc406607d9, 664DA16141902EE5CF70331F943976485F5C157F) smtp.auth=andi@etezian.org X-OVh-ClientIp: 188.155.229.193 From: Andi Shyti To: linux-i2c Cc: Andi Shyti , Bjorn Andersson , Gaosheng Cui , Konrad Dybcio , Vladimir Zapolskiy Subject: [PATCH 2/2] i2c: qcom-geni: Use goto for clearer exit path Date: Mon, 12 Aug 2024 21:40:29 +0200 Message-ID: <20240812194029.2222697-3-andi.shyti@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240812194029.2222697-1-andi.shyti@kernel.org> References: <20240812194029.2222697-1-andi.shyti@kernel.org> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Ovh-Tracer-Id: 7309623672837769845 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddruddttddgudeflecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeetnhguihcuufhhhihtihcuoegrnhguihdrshhhhihtiheskhgvrhhnvghlrdhorhhgqeenucggtffrrghtthgvrhhnpefgudevjeetgeetlefhteeuteehgeefhefhkedtvdelheethfehveekudelueeuveenucfkphepuddvjedrtddrtddruddpudekkedrudehhedrvddvledrudelfedpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomheprghnughisegvthgviihirghnrdhorhhgpdhnsggprhgtphhtthhopedupdhrtghpthhtoheplhhinhhugidqihdvtgesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheehtddpmhhouggvpehsmhhtphhouhht Refactor the code by using goto statements to reduce duplication and make the exit path clearer. Signed-off-by: Andi Shyti --- Cc: Bjorn Andersson Cc: Gaosheng Cui Cc: Konrad Dybcio Cc: Vladimir Zapolskiy drivers/i2c/busses/i2c-qcom-geni.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 06e836e3e8773..ebb5900fd3227 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -986,21 +986,24 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev) return ret; ret = clk_prepare_enable(gi2c->core_clk); - if (ret) { - geni_icc_disable(&gi2c->se); - return ret; - } + if (ret) + goto out_icc_disable; ret = geni_se_resources_on(&gi2c->se); - if (ret) { - clk_disable_unprepare(gi2c->core_clk); - geni_icc_disable(&gi2c->se); - return ret; - } + if (ret) + goto out_clk_disable; enable_irq(gi2c->irq); gi2c->suspended = 0; + return 0; + +out_clk_disable: + clk_disable_unprepare(gi2c->core_clk); +out_icc_disable: + geni_icc_disable(&gi2c->se); + + return ret; } static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev)