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 CBEF42248B8; Thu, 12 Dec 2024 16:50:37 +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=1734022237; cv=none; b=UsyS6oDfcvzHR2W7v/sN4uKqO894zRHE22R5jslrtAW1VnU34nxevM/lgm6ZlwSg4oVOUkNcCA8X0nZmP5K/Z+g7gupgsY7d9muotzMj4vaMr9i6UYREGYbNqI2hnlChiv3q9dNXerj25FOJZN9UkwD86WM8bBUt7Ug3KAVBZ3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734022237; c=relaxed/simple; bh=XW3yQxMbIyeA3VR9Bl6oqND+tdvWuyLXiFIOZHJPPaA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qhd8ZkqGAajxPjYmCo0ByKcEpFsTz7r1WKixC1jWWAaGmRTXPfWMAa3yLlR4sKLkau3k8U9kIgkns503DPUt3bdQHo/z1/4CeyKON+qON14BNFEX2NxSInE3IaZoGXS4iIOzHcgHyc5dNi0r4ad8IaAaZWOjJiimgT/sr7AuW3Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aRPiPe6U; 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="aRPiPe6U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2131CC4CECE; Thu, 12 Dec 2024 16:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734022237; bh=XW3yQxMbIyeA3VR9Bl6oqND+tdvWuyLXiFIOZHJPPaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aRPiPe6UBS2HtcLH4jEg0ph7Esa5+AfTlF3NLo+ffS9+wuRudwueLcoh/szU2NPRx Mkkug/U9E7fwo1nmjiTQy1UPuCWsl3Hl5ACQOpBj3a/qLLrnlRqrnsnYWRfUY3av9c 5oWZoodJKKCRUjfAXFpLZ3ODNeOhkMc82EqCMSBQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yuan Can , =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 184/565] wifi: wfx: Fix error handling in wfx_core_init() Date: Thu, 12 Dec 2024 15:56:19 +0100 Message-ID: <20241212144318.745403139@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144311.432886635@linuxfoundation.org> References: <20241212144311.432886635@linuxfoundation.org> User-Agent: quilt/0.67 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuan Can [ Upstream commit 3b88a9876779b55478a4dde867e73f7a100ffa23 ] The wfx_core_init() returns without checking the retval from sdio_register_driver(). If the sdio_register_driver() failed, the module failed to install, leaving the wfx_spi_driver not unregistered. Fixes: a7a91ca5a23d ("staging: wfx: add infrastructure for new driver") Signed-off-by: Yuan Can Reviewed-by: Jérôme Pouiller Signed-off-by: Kalle Valo Link: https://patch.msgid.link/20241022090453.84679-1-yuancan@huawei.com Signed-off-by: Sasha Levin --- drivers/staging/wfx/main.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/main.c b/drivers/staging/wfx/main.c index 9ff69c5e0ae97..9849d0998a636 100644 --- a/drivers/staging/wfx/main.c +++ b/drivers/staging/wfx/main.c @@ -476,10 +476,23 @@ static int __init wfx_core_init(void) { int ret = 0; - if (IS_ENABLED(CONFIG_SPI)) + if (IS_ENABLED(CONFIG_SPI)) { ret = spi_register_driver(&wfx_spi_driver); - if (IS_ENABLED(CONFIG_MMC) && !ret) + if (ret) + goto out; + } + if (IS_ENABLED(CONFIG_MMC)) { ret = sdio_register_driver(&wfx_sdio_driver); + if (ret) + goto unregister_spi; + } + + return 0; + +unregister_spi: + if (IS_ENABLED(CONFIG_SPI)) + spi_unregister_driver(&wfx_spi_driver); +out: return ret; } module_init(wfx_core_init); -- 2.43.0