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 A96331DE3AA; Wed, 19 Mar 2025 14:39:20 +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=1742395160; cv=none; b=i6A5IPr6Cjhsr3PK3wyB5oUQZQPFf7y/w7gyuOljahyu7Mrk7Pn6DLOvHSTD8bBtl3V5kqBuPr0OeGGCA43Vx8tp1Lq0jID1+xd948DHUweZMN6e1NDVyiz+BliUzkJ0uBJuAIwUegYim0Pgs25YxR3jHBJncKyRcGw8c9vtmZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742395160; c=relaxed/simple; bh=FqwdQnwLzCUgaO18+ONFgc3FsafUOpRiJ/nezDxBnKM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qRtuIiSHU9LZU3dV5RlaEF1YbJ4nZEdb92kwFlhheh5jwysLSIuLnFEi6N8Oh4+LEAo3ku2iwYqhBNt8otT3fklbwL0km3GvUgFkdEUSZgIT5Pt73QVnAOKGFJAJyZ2tbvMn74NvsvtTa3su8mCoLH4aajAjzOTkQ5oLAkDWH6E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H4jYCQBS; 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="H4jYCQBS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D065C4CEE4; Wed, 19 Mar 2025 14:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1742395160; bh=FqwdQnwLzCUgaO18+ONFgc3FsafUOpRiJ/nezDxBnKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H4jYCQBSGKddmJnSfR5YjdZmZPJ4NJ6kkeAbT/NygTGKfoHTBnvuubIFFHy0F7mgZ l/Iv519VsCPLACZsdaiZH8mjTMJgr2AQMsTVcweZ57Crjpd5+vJIVYM10D0mtOqH7E zWxTLlyp30auzVSUgxQlFBCN9txCtQ1yO2SuLVuk= 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 220/231] i2c: ali1535: Fix an error handling path in ali1535_probe() Date: Wed, 19 Mar 2025 07:31:53 -0700 Message-ID: <20250319143032.276110663@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 9b5463f349d019a261f1e80803447efca3126151 ] If i2c_add_adapter() fails, the request_region() call in ali1535_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 Signed-off-by: Andi Shyti Link: https://lore.kernel.org/r/0daf63d7a2ce74c02e2664ba805bbfadab7d25e5.1741031571.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-ali1535.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index 544c94e86b896..1eac358380405 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c @@ -485,6 +485,8 @@ MODULE_DEVICE_TABLE(pci, ali1535_ids); static int ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) { + int ret; + if (ali1535_setup(dev)) { dev_warn(&dev->dev, "ALI1535 not detected, module not inserted.\n"); @@ -496,7 +498,15 @@ static int ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) snprintf(ali1535_adapter.name, sizeof(ali1535_adapter.name), "SMBus ALI1535 adapter at %04x", ali1535_offset); - return i2c_add_adapter(&ali1535_adapter); + ret = i2c_add_adapter(&ali1535_adapter); + if (ret) + goto release_region; + + return 0; + +release_region: + release_region(ali1535_smba, ALI1535_SMB_IOSIZE); + return ret; } static void ali1535_remove(struct pci_dev *dev) -- 2.39.5