From patchwork Sat Jan 6 16:54:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 13512756 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 066B8C46CD2 for ; Sat, 6 Jan 2024 16:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=w7JfjTNVcwALU4SM8eBdDTkIve+YyZoZdE+uDvH0leg=; b=vX0aYBSsjn85Lp 20sMZhr5QhFYIjohT8eSczxXDvyI1vXKPNQlc9OTMUnjHmhmV+J/DPHxv4rHF7Wl6/S8DJLaZL39W 5RV6Pl+cy1Q5TUgOwSdhNZmEpP+7eQxZreaEZppdut+FV9fYcFs7uSDVal3GoKVw5C7eJKXrcjYun RYzsXC1fqQK+Pgfs/hFl0mg4mGbpoOMsKb1XclMxwMRfzvRYj50r6JMBFSamIlYHcJVELMGif7iMf jAB5GTS/j+QbsPB90F0nkayYooTgYga5itTU/du1sIZazzixGEQJMPDm1A6gdZH8st5QGoFkZbYR0 SnB+hzBvqaT/20zVQ8Bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rM9yJ-001csU-0P; Sat, 06 Jan 2024 16:56:31 +0000 Received: from smtp-29.smtpout.orange.fr ([80.12.242.29] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rM9yE-001crn-06 for linux-arm-kernel@lists.infradead.org; Sat, 06 Jan 2024 16:56:29 +0000 Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id M9xzrDJlNBraWM9xzrWFWc; Sat, 06 Jan 2024 17:56:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1704560178; bh=yxMqrM3/fvbfO88ABtYbx7NWceijjlxlXEA90xmaYA0=; h=From:To:Cc:Subject:Date; b=rlNlhTFEC9f4inef+lf/dqwjC6inG5OTzyCnwH1SkqPlcup4CakBb1p4u6RLHfltu AXWkGzxX5hDzkzaH7RicUdgreY4FqBgAcnR9MC4+qYhv7KuJ7rqv4IGv30y2p22m2F Y3qGzVVktnp9pMm4/AQE2d9YdVYjGyOiK4m8MuIJYfJdD+zBp4z8OgYnKoHGna7jgr w5sHOxSFfui4C4dxQnYlDbZEiKMjkNGjrhuqKC6CA7mcTJu/0kAxuZVGT6UxQLCjco /51aWVLTTaxYrNUkHqWPGyxd26DdK7IqiLE6tnatBnawdV1skFgIpC4oJOQsNy8sTz /ZvnJmhhYMWlA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 06 Jan 2024 17:56:18 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Yannick Fertre , Raphael Gallais-Pou , Philippe Cornu , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Maxime Coquelin , Alexandre Torgue , Eric Anholt , Neil Armstrong Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Yannick Fertre , dri-devel@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH] drm/stm: Fix an error handling path in stm_drm_platform_probe() Date: Sat, 6 Jan 2024 17:54:32 +0100 Message-Id: <20fff7f853f20a48a96db8ff186124470ec4d976.1704560028.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240106_085626_500114_32D40DB4 X-CRM114-Status: GOOD ( 11.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If drm_dev_register() fails, a call to drv_load() must be undone, as already done in the remove function. Fixes: b759012c5fa7 ("drm/stm: Add STM32 LTDC driver") Signed-off-by: Christophe JAILLET Acked-by: Raphael Gallais-Pou --- This was already sent a few years ago in [1] but it got no response. Since, there has been some activity on this driver, so I send it again. Note that it is untested. [1]: https://lore.kernel.org/all/20200501125511.132029-1-christophe.jaillet@wanadoo.fr/ --- drivers/gpu/drm/stm/drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index e8523abef27a..4d2db079ad4f 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -203,12 +203,14 @@ static int stm_drm_platform_probe(struct platform_device *pdev) ret = drm_dev_register(ddev, 0); if (ret) - goto err_put; + goto err_unload; drm_fbdev_dma_setup(ddev, 16); return 0; +err_unload: + drv_unload(ddev); err_put: drm_dev_put(ddev);