From patchwork Fri Jan 5 14:39:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13512236 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC709C3DA6E for ; Fri, 5 Jan 2024 14:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=u7cx9mEnYPcVgwRs1e3rHEjeBc78f+gzDLhsvPkbH/0=; b=D2a61OmXVPo8YT 05GeWz/LwSjnK3V1qyikt0zyO6J4IJKYF28Ffi7yZNfckibNH1XYzzUB3MrtFNOxtVJiHqgpoexwe jt+BQMnJRfOEXBiAzmyksc1TmhHCxJcP2WO0LONpEPdomWlA6VjIIWGNsh0HptFrpJbtP8ztJTWK/ a9Ui9/Li4q0Xb411tBui78IlGLIDHIy0BHg7Hw4VjGOUsgpCCwMXavJmETC45FFxnC4CBOu1j9Qm+ h9ucq9abiwYCX+JRGx688aVhMTE1v8sNsPkr2EACdunAAQor4Q1HBGbajMRd4lSTVAX7w+KeJCYgq XtZabIzmQpCez11OxUCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLlMb-00H5du-0X; Fri, 05 Jan 2024 14:39:57 +0000 Received: from smtp-14.smtpout.orange.fr ([80.12.242.14] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rLlMX-00H5cI-1J for linux-arm-kernel@lists.infradead.org; Fri, 05 Jan 2024 14:39:56 +0000 Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id LlMLrGEYBZHPALlMLrhVSf; Fri, 05 Jan 2024 15:39:43 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1704465583; bh=mlZMWue+rUHLA0FDYtCvHGfyfaAK8CYgvZJbBND9Z+Y=; h=From:To:Cc:Subject:Date; b=n0RgGpMbquaY8uZqtu9kYIqiEkIlQG491OL3+S943O0v+1ibtaO4NA19Jydhy7EPr hIeuUcUiIcS64oIyCAXIWccbQ4eGlSsEMaka7v8MhDmxu103Lxh5Nz8rA4zfaP1fAJ hr1FvHhm7XWwjH8pViq18YbgTvX2N3IF2hhrdNq72Y6TKTPA3SbqHwkkJbU1cm+uTn OXZEsg5NFyJGwQAzddyV1UHLlom65hN7+RpgYXxn9RLvnlV+s6jWbaA0dO73MVLJ16 d6tgpGK/2+GIPCVsX1gmpl/ZsgXIpB6/pJlhzE26UovHf2dZfQlCX7rknleDs+m71t BfXeuUlCDzktA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 05 Jan 2024 15:39:43 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: andi.shyti@kernel.org, wsa@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] i2c: wmt: Fix an error handling path in wmt_i2c_probe() Date: Fri, 5 Jan 2024 15:39:35 +0100 Message-Id: <6ed30ecf43a4c8574aa6b9f93be50f3203a42850.1704465414.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240105_063953_600564_F8CCC939 X-CRM114-Status: GOOD ( 10.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org wmt_i2c_reset_hardware() calls clk_prepare_enable(). So, should an error occurs after it, it should be undone by a corresponding clk_disable_unprepare() call, as already done in the remove function. Fixes: 560746eb79d3 ("i2c: vt8500: Add support for I2C bus on Wondermedia SoCs") Signed-off-by: Christophe JAILLET --- drivers/i2c/busses/i2c-wmt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c index ec2a8da134e5..198afee5233c 100644 --- a/drivers/i2c/busses/i2c-wmt.c +++ b/drivers/i2c/busses/i2c-wmt.c @@ -378,11 +378,15 @@ static int wmt_i2c_probe(struct platform_device *pdev) err = i2c_add_adapter(adap); if (err) - return err; + goto err_disable_clk; platform_set_drvdata(pdev, i2c_dev); return 0; + +err_disable_clk: + clk_disable_unprepare(i2c_dev->clk); + return err; } static void wmt_i2c_remove(struct platform_device *pdev)