From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1A09C1EF394; Wed, 19 Mar 2025 14:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742395149; cv=none; b=QDPj7PZgD1YDOaKtk8XVh602RQFSauSffOOP1tFBYbHaAE+ssy1egiqWInRiJOnfBDcyOuNy0qMrW+9WVqUzm0O2edAuF+WuWyYZLtwdWvHpA/9J6y4l/I+Lq7+nABNOKMTGC+6Wc3TyJWbgAPmFd8Klq+eLUKQ+Dg5e/aL3b78= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742395149; c=relaxed/simple; bh=vyDrr9yv015p7d+c9qFOLyAULdOGetg3MEAWLxl4QrE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mTsZawzVitWD26YVXy2ram1mGnUf++jZTKLq2a2Qf4YBiUKJR6Yw54GfvTVBi6qsbEDI9p2igmnn5eQmH81AIbgeDFG7g0C4PF0cicT+EDhw+cefoNrICJSU/4/q8U7d0hNfedcJUbFjJHIfz0H+orwehMmJovDKGgu5VVnvMW8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pqd7R6UZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pqd7R6UZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB7A0C4CEE8; Wed, 19 Mar 2025 14:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1742395148; bh=vyDrr9yv015p7d+c9qFOLyAULdOGetg3MEAWLxl4QrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pqd7R6UZ3QTS83gpDTkUGi0OtLJ0ZnWKtPjbXfPRS+KHpxOMfcQ0ZXjFMMKkpv8wu SS/df8OXkAkliVUTXVkSSENJMfxSbM7IJTo7XIhxsjN97MyJHXY4gaR2kgWO7D96ji b2yWB9KI2zKXsvYoqWUaWawDAovyp6n4YC4suV6w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christophe JAILLET , Andi Shyti , Sasha Levin Subject: [PATCH 6.12 222/231] i2c: sis630: Fix an error handling path in sis630_probe() Date: Wed, 19 Mar 2025 07:31:55 -0700 Message-ID: <20250319143032.322407652@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250319143026.865956961@linuxfoundation.org> References: <20250319143026.865956961@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christophe JAILLET [ Upstream commit 2b22459792fcb4def9f0936d64575ac11a95a58d ] If i2c_add_adapter() fails, the request_region() call in sis630_setup() must be undone by a corresponding release_region() call, as done in the remove function. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/3d607601f2c38e896b10207963c6ab499ca5c307.1741033587.git.christophe.jaillet@wanadoo.fr Signed-off-by: Andi Shyti Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-sis630.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 3505cf29cedda..a19c3d251804d 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c @@ -509,6 +509,8 @@ MODULE_DEVICE_TABLE(pci, sis630_ids); static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id) { + int ret; + if (sis630_setup(dev)) { dev_err(&dev->dev, "SIS630 compatible bus not detected, " @@ -522,7 +524,15 @@ static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id) snprintf(sis630_adapter.name, sizeof(sis630_adapter.name), "SMBus SIS630 adapter at %04x", smbus_base + SMB_STS); - return i2c_add_adapter(&sis630_adapter); + ret = i2c_add_adapter(&sis630_adapter); + if (ret) + goto release_region; + + return 0; + +release_region: + release_region(smbus_base + SMB_STS, SIS630_SMB_IOREGION); + return ret; } static void sis630_remove(struct pci_dev *dev) -- 2.39.5