From patchwork Sun Jan 23 17:51:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 12721035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5468FC433EF for ; Sun, 23 Jan 2022 17:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239344AbiAWRwP (ORCPT ); Sun, 23 Jan 2022 12:52:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232441AbiAWRwN (ORCPT ); Sun, 23 Jan 2022 12:52:13 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2560C061401 for ; Sun, 23 Jan 2022 09:52:12 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nBh29-0007aE-Qo; Sun, 23 Jan 2022 18:52:09 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nBh28-00BycB-7D; Sun, 23 Jan 2022 18:52:07 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nBh26-000tzX-Kp; Sun, 23 Jan 2022 18:52:06 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Mark Brown Cc: linux-spi@vger.kernel.org, kernel@pengutronix.de, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-fbdev@vger.kernel.org, Noralf Tronnes , linux-staging@lists.linux.dev, dri-devel@lists.freedesktop.org, Thomas Petazzoni , Heiner Kallweit Subject: [PATCH 1/5] staging: fbtft: Fix error path in fbtft_driver_module_init() Date: Sun, 23 Jan 2022 18:51:57 +0100 Message-Id: <20220123175201.34839-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220123175201.34839-1-u.kleine-koenig@pengutronix.de> References: <20220123175201.34839-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1472; h=from:subject; bh=i2X5yNCIOCOFDIMQl+gbf/QxZ3EJl4WBdI8+Ry87svQ=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBh7ZWrOh19itJwy3A6u3yWbUTSiEplUaCg/AdalVp/ 1dxUs4SJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCYe2VqwAKCRDB/BR4rcrsCcnVCA CGzmOKybWQk3bG9qPzyrR4sinHLhsqEKAvXaLEm5q8uy0OpszNQ7nW1a0QM6JkRi3oCfPUu6EgwGl0 Te30YS0YHfiZzBt2r5ajXFNJChzYJwr2BcogYA4ep+/F6Y4S2zkX/zZ7rAeh4qRPXj1A5SyHvrSvTW wMihZM7kIOX4GbOy++5PGjG/Bojb0MFgVoHuEemX7mkjQ4FEE0kYBDL1+FY4yVAnn8NrTGg2EyFbRY ePWfgrh5brbPbyibSbwh5Uxp5xLiE9CP6vNZzvhGjCSb7CpGAls8G/l1H7743sjHSdn2gBreuYrocS 6AFKf/IGRfm3gnK8hvjx9Oz1/2Db27 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-spi@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org If registering the platform driver fails, the function must not return without undoing the spi driver registration first. Fixes: c296d5f9957c ("staging: fbtft: core support") Link: https://lore.kernel.org/r/20220118181338.207943-1-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König --- drivers/staging/fbtft/fbtft.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 4cdec34e23d2..55677efc0138 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -334,7 +334,10 @@ static int __init fbtft_driver_module_init(void) \ ret = spi_register_driver(&fbtft_driver_spi_driver); \ if (ret < 0) \ return ret; \ - return platform_driver_register(&fbtft_driver_platform_driver); \ + ret = platform_driver_register(&fbtft_driver_platform_driver); \ + if (ret < 0) \ + spi_unregister_driver(&fbtft_driver_spi_driver); \ + return ret; \ } \ \ static void __exit fbtft_driver_module_exit(void) \