From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-m155101.qiye.163.com (mail-m155101.qiye.163.com [101.71.155.101]) (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 62D0E3FE37E for ; Wed, 13 May 2026 12:05:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778673956; cv=none; b=umdJW+F4tIt8JlZpTPxFAnH8/sUye2KAc9AdRJDpts2HApAFaLsbhrQUfOb6hUae6Y0ARs/7zRjY+AhVWo/wc6i44JW+0miLWjXSQgbIQ1DntHpDxUmTEkf9H9YFSBOJD9ORuBaq7js8CvczHyFcCfzwloRGAk/BwIXxNie5fGQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778673956; c=relaxed/simple; bh=RsMkjUqWCchYZ10pUip4CEypkCsIWmxNBqLg8pwhpsM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jgwM/fcU5fXL2KLI22bac51ly63uGMeXedNtOTlmVwiUNiVT298Uy7mcxZb7HjSCLoi+qpdrwRH5wRWkbYXxvugk1+8ecXaggT6ym5LtfEwBpsYCJuJeYhCEv7dJK/Swbp2bW1iuAPSORYBWCHMCiy3caZ0lfU2xyKVGtZRtMcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn; spf=pass smtp.mailfrom=seu.edu.cn; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b=l65gntyR; arc=none smtp.client-ip=101.71.155.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b="l65gntyR" Received: from LAPTOP-99KJFSET (unknown [112.10.223.127]) by smtp.qiye.163.com (Hmail) with ESMTP id 3e43f8521; Wed, 13 May 2026 20:00:35 +0800 (GMT+08:00) From: Hongyan Xu To: tomi.valkeinen@ideasonboard.com Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, getshell@seu.edu.cn, jianhao.xu@seu.edu.cn, Slavin Liu <220245772@seu.edu.cn> Subject: [PATCH] drm/omapdrm: avoid double drm_mode_config_cleanup() Date: Wed, 13 May 2026 20:00:34 +0800 Message-ID: <20260513120034.182-1-getshell@seu.edu.cn> X-Mailer: git-send-email 2.50.1.windows.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0a9e2135cf9603a1kunm47f9c4fb6587c X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkZQ0pNVklMTksdS0tNSkhMHVYeHw 5VEwETFhoSFyQUDg9ZV1kYEgtZQVlKSklVSktVSUlIVUpJTFlXWRYaDxIVHRRZQVlLVUtVS1VLWQ Y+ DKIM-Signature: a=rsa-sha256; b=l65gntyRAbfrjpZsAnTZmep7Yla+HAobTstcsS2Iu0zzceCC5StCYR3ci5iCFLATIleyfvTQQfXErjCI8qs0gEsZ2vuHE8rGkp112cFPnabLlj7RtrETXFPy6OtWtrGjd+/LehALrR9nuAQu8tx4PBk5J0DordEBIpJSesyjO4c=; c=relaxed/relaxed; s=default; d=seu.edu.cn; v=1; bh=Xa0d+UNBMZwuB0ZCYSY8W+dd2tOK9S8K+AuU2bmHfsw=; h=date:mime-version:subject:message-id:from; omapdrm_init() unwinds drm_vblank_init() and drm_dev_register() failures through omap_modeset_fini() and then falls through to err_gem_deinit, which calls drm_mode_config_cleanup() again. omapdrm_cleanup() has the same problem during the normal teardown path: it calls omap_modeset_fini() and then calls drm_mode_config_cleanup() again afterwards. omap_modeset_fini() should only undo omap_modeset_init(). The drm_mode_config_init()/drm_mode_config_cleanup() pairing already lives in the top-level init and cleanup paths, so keeping another drm_mode_config_cleanup() inside omap_modeset_fini() causes repeated cleanup of the same mode_config state. Remove drm_mode_config_cleanup() from omap_modeset_fini() so each path cleans mode_config exactly once. Fixes: 2f95bc6d324a ("drm: omapdrm: Perform initialization/cleanup at probe/remove time") Issue found using a prototype static analysis tool and confirmed by code review. Signed-off-by: Hongyan Xu Signed-off-by: Slavin Liu <220245772@seu.edu.cn> --- drivers/gpu/drm/omapdrm/omap_drv.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index bf0bad8c8cf1..838a1a236160 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -538,8 +538,6 @@ static int omap_modeset_init(struct drm_device *dev) static void omap_modeset_fini(struct drm_device *ddev) { omap_drm_irq_uninstall(ddev); - - drm_mode_config_cleanup(ddev); } /* -- 2.50.1.windows.1