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: 185425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6261204dyb; Fri, 5 Jan 2024 06:40:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUq/0B7V71n9tIwYTFJDm0LaOiqtqf0IA5HLce6uHGrd7h+qQ10ZoLvBefWP4gt/Asjdqm X-Received: by 2002:a05:6e02:174c:b0:35f:b84f:ee5a with SMTP id y12-20020a056e02174c00b0035fb84fee5amr2424699ill.75.1704465634678; Fri, 05 Jan 2024 06:40:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704465634; cv=none; d=google.com; s=arc-20160816; b=eEPULlxaouv6nrOPtOat92SSh6TMkdEvtR+Sq3syRorkim7JNXZKSEm5QeGEE7fNZ7 XLWd7CGdV4Sz0DorEhA7/OKWWdZxpOItIt4yaxaud8lpMUO2smDA/76r1JUhcWzuH00T oWB7KQtQ61biOKS79m17oKG38XwXKJCpOGhyh3Yu68Q6/pl1ij2ile3AgU194HSz40l+ lvuAz9JVSgg70L+HfrJ9Jt+Sm/ndJ1Qx/lOrxvQdsrbkRIYYhN5nL/FZ/cM1XfttQRU6 /XRCLbG4QcHWDL/6j43S8BmcGiXyTD79RPIXFwcMbV4JNBF8Cv1VCclV66XM/3Rp6XRW r76A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=mlZMWue+rUHLA0FDYtCvHGfyfaAK8CYgvZJbBND9Z+Y=; fh=ctWw7XC3YN5vlJpEtiP2zhgLzbk1nExASGouDCjyBeM=; b=kqJFyn3TUYGlVSSKku39LE8OsaXPH9nR9RnwPYRFLco90rqObeefgusZPLXl/Kvz2G jXWEKTE3ylPMXSJRfY7eJYjjVlzsmDn5MVNhY3OFZF84eODTlkuLD87k9wTfmfWrShVy WNMlSt//r3yZyHMOE5IIj2Dusbej8gW8mU1V0p5/zn06LjioNLjVKX/a0RGYZc0k1NFc yVWnR2YrJl6ZFHcLT+dlQ5k71IXt/PbqTWS+gwlf48Vmmn2UPru14c9Ou0OqR8EKZ2nX a2/9/oyuPP97iLeJBbCrewMLy8HShXpKATWhfx9xTfc9dlHj/2EbQANH4r/VB7QbburS 1LAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=n0RgGpMb; spf=pass (google.com: domain of linux-kernel+bounces-17947-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17947-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s16-20020a656450000000b005cecc60c8casi1377673pgv.30.2024.01.05.06.40.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 06:40:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17947-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=n0RgGpMb; spf=pass (google.com: domain of linux-kernel+bounces-17947-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17947-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7B8D4B21201 for ; Fri, 5 Jan 2024 14:40:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6E4D2E415; Fri, 5 Jan 2024 14:39:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="n0RgGpMb" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.smtpout.orange.fr (smtp-14.smtpout.orange.fr [80.12.242.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD86D2D051 for ; Fri, 5 Jan 2024 14:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787261757445089715 X-GMAIL-MSGID: 1787261757445089715 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)