Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6018689pxb; Mon, 14 Feb 2022 13:15:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUJ18nV9yqg+/6NlrHBC4RoEAcOvDMHTkQ8jLBRHNOsMAbOnsIf2NWN7XwKhABUiBFHOYt X-Received: by 2002:aa7:9e85:: with SMTP id p5mr1028262pfq.84.1644873347321; Mon, 14 Feb 2022 13:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873347; cv=none; d=google.com; s=arc-20160816; b=Rgxi4xdY0nzqeh8d7i5y4CAJO1mt65xKRK5JDS/h0JpobYT6iHYXHiuiSyl/acFIgv cQy4SYKjyULva7uhT/wHl+mxzhC2lLb9cCBVMJXQnPEojdTBiIMOubxWVd5iGnizKmoQ QvlQz1i0iIIMDMQGaujJVxJQMBzbGGHp0UY2ItR/Iajedl9uUk8/RcnwoDonF2Lu2zJR jqGAUQwQPYhiqzAijWGvSWH7Ulq4m6gkqV6v21Os0HnUEqCCvzd8xkag61Y6Xkt8jbhJ uuOeTHDqlEUF820wcgnS/rm0eX+yMYzzd3IBYnHtVcJgOCdqKnYyM5QqCRNsp0RxixmI fjJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y2lZWTLjXy86+B6iqaf5PNPsFXJjt7Q7RyAJH6bdL3Y=; b=ntW2Thw6q7v5T86GDDPdZsMVVWiaGbZaLTI2+ZVbINFYls6SWeL6jXZmIFAeF4AXHA lXws1JSjuMPk3/3Kt/Vh9LXXSQZFISjdLnviaP02kydxAoA0gWAA1r9Nv8rJSCJ/UBni yom2jwDlGZ7tEOV7MgyXn6o4EkM2VGwPklrUR+j7nImyLAMGhz5AgHJZRgN+o+9XUYO1 GiXKK9WQeIiZfBgyETmwBMGroRXHPi3EFkK6pHSzPSG9V6DGmww8AjhsRCDnATfNiwFG HhZ/yyGFlcQMitudWjshv4HEcIvoS7fVP/0KahUAZck9jelNIRySKCQfzI3mPKxiQYXu WIiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XILD0+U/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f190si716697pgc.650.2022.02.14.13.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:15:47 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XILD0+U/"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 328311A2E45; Mon, 14 Feb 2022 12:35:29 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347660AbiBNKag (ORCPT + 99 others); Mon, 14 Feb 2022 05:30:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347710AbiBNKaG (ORCPT ); Mon, 14 Feb 2022 05:30:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADC337093D; Mon, 14 Feb 2022 01:58:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D63BB80DC8; Mon, 14 Feb 2022 09:58:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 740A4C340E9; Mon, 14 Feb 2022 09:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832712; bh=JfL+GhWxwE5F5v6NmdagFTHsk5XA1TJAJFpQryMWtWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XILD0+U/KaiC2gYfkrFyBkD417RQrH+0ZnAwFHz1iuidu1JDdYnPi+BupgansWVyd MjjEhpbg3Iw1+unJQbpOoQVuRvv58hQuzvcjigk/dBRIE4XcodlkIkFTDyL99Y3uEr UejIO3zvA/6n+J6DOyp0KEAUM6WZNocrUNifAxmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Sasha Levin Subject: [PATCH 5.16 100/203] staging: fbtft: Fix error path in fbtft_driver_module_init() Date: Mon, 14 Feb 2022 10:25:44 +0100 Message-Id: <20220214092513.650977713@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-König [ Upstream commit 426aca16e903b387a0b0001d62207a745c67cfd3 ] If registering the platform driver fails, the function must not return without undoing the spi driver registration first. Fixes: c296d5f9957c ("staging: fbtft: core support") Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20220118181338.207943-1-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 6869f3603b0e6..9a6c906820f22 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) \ -- 2.34.1