Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp180910rdb; Fri, 5 Jan 2024 06:40:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjtQsCdw2xhdhXKoHzmYAVGSWYSKfRiauO08E8gL8fDdO0gMvZmYCYZPMmbKIytraCcAKT X-Received: by 2002:a05:620a:859:b0:781:afe:b8f4 with SMTP id u25-20020a05620a085900b007810afeb8f4mr2185853qku.2.1704465600034; Fri, 05 Jan 2024 06:40:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704465600; cv=none; d=google.com; s=arc-20160816; b=pzhDhy0EdUeoUWVUeG+grSn04+1UnRdbgUvXE32sf+iy8W2tztjcI8tx5nquZFQEqT vruJIdzr4EdY10RqUqIKsxAd8cL9kNyhQkEOQdGUCS2p6cPZN+uBf3+iOSk9sh74wHeV E3LoEhqgOL+fANhNUKALvDq4qhFWiNZQ7Q4YvZ8ZL5G97C0LkUwNUHI9py8RRmrszHcO ZhbB45Sjua2F+BZZW/qTx+AblRFa/RC4KtsliGc1sDmxy/QHUIDL/PfX6FkXvmD5U1NN isUV8O7dRI7AcDpI5CNOv6LSyemAZytB83HAQoYTJadjkMI6Oe+tTWjGgjv9W6Fr3IwB 9XvA== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17947-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s22-20020a05620a0bd600b0078156a6a506si1881358qki.157.2024.01.05.06.39.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 06:40:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17947-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17947-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C27FD1C21A5D for ; Fri, 5 Jan 2024 14:39:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 148D02E3F7; Fri, 5 Jan 2024 14:39:48 +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 Content-Transfer-Encoding: 8bit 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) -- 2.34.1