From nobody Sat Jul 25 03:46:05 2026 Received: from mail-m49198.qiye.163.com (mail-m49198.qiye.163.com [45.254.49.198]) (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 96EDE25B086 for ; Sun, 19 Jul 2026 14:43:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.49.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784472202; cv=none; b=R4C501qaFspqaQo6HM5WTr0RNie/y4fAYrcxSHNTi7J2xO4Py6RZEtndMVWmyc9Cr0we485DNLSRde6Mre8dpsB5P5uSNH1uKIdIAuzjUErEuhnbtU0VMgsHqLMJkBTTmFQnAfG+LKha26TtHNN3KC/XxVoSgVkeiYQ09Aco0wQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784472202; c=relaxed/simple; bh=JEbBMX+fF9U6xUdt3zGXciae6Tf9Zxhjeg1JQfOlQfE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=GzyQfUxhlFCegSfOxvdhpNApvkf0hZyLZRLNmorHNT4Gqq6fnugMbHad+k/bkQwvArv7mDqPhbQ3mK1b8MSTnVwvnb4T3H3XVO9cVVeshaWwoz2N+5sW8zOzrcJ5Oumh4kW5GVluBsR9BImp2vS89m2VK6BTzONvXpjQhMunIDc= 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=TG/lX7KU; arc=none smtp.client-ip=45.254.49.198 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="TG/lX7KU" Received: from LAPTOP-99KJFSET (unknown [222.191.246.242]) by smtp.qiye.163.com (Hmail) with ESMTP id 46bb6c3c1; Sun, 19 Jul 2026 22:43:07 +0800 (GMT+08:00) From: Hongyan Xu To: ojeda@kernel.org Cc: linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn, getshell@seu.edu.cn Subject: [PATCH] auxdisplay: charlcd: cancel backlight work on registration failure Date: Sun, 19 Jul 2026 22:43:05 +0800 Message-ID: <20260719144305.1108-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: quoted-printable X-HM-Tid: 0a9f7ad4b17603a1kunm7b06cc50954fc X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlCS0oaVk8eS09KSU8fGUxMTlYeHw 5VEwETFhoSFyQUDg9ZV1kYEgtZQVlJSUlVSkJKVUlPTVVJT0lZV1kWGg8SFR0UWUFZT0tIVUpLSU hOQ0NVSktLVUtZBg++ DKIM-Signature: a=rsa-sha256; b=TG/lX7KU8UOdf6QqpJNWapx+i2+u5O7b4EwvOLebFgAgJLWpyZgt168GL9N5tmMad8gR1chguMiAolOrh6X6F2AXCoClUpWuoCFfHtetdafTZLVMrEIAANiBINCT9dqlC3t/QGAodHEYBIMATyJrfEFn1Dr1XEIm9J6JTkQC6tQ=; s=default; c=relaxed/relaxed; d=seu.edu.cn; v=1; bh=L+eIwO4+ZrV0rrXitPK89HVqkGeLsY1Mg5MQ39c/X6E=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" With CONFIG_CHARLCD_BL_FLASH, charlcd_init() schedules bl_work before charlcd_register() calls misc_register(). If registration fails, the caller frees the charlcd object while delayed work still contains its address. Cancel the delayed work and turn the backlight off before returning the registration error. Signed-off-by: Hongyan Xu --- drivers/auxdisplay/charlcd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c index 6d309e4..92530e0 100644 --- a/drivers/auxdisplay/charlcd.c +++ b/drivers/auxdisplay/charlcd.c @@ -645,6 +645,7 @@ static struct notifier_block panel_notifier =3D { =20 int charlcd_register(struct charlcd *lcd) { + struct charlcd_priv *priv =3D charlcd_to_priv(lcd); int ret; =20 ret =3D charlcd_init(lcd); @@ -652,8 +653,13 @@ int charlcd_register(struct charlcd *lcd) return ret; =20 ret =3D misc_register(&charlcd_dev); - if (ret) + if (ret) { + if (lcd->ops->backlight) { + cancel_delayed_work_sync(&priv->bl_work); + lcd->ops->backlight(lcd, CHARLCD_OFF); + } return ret; + } =20 the_charlcd =3D lcd; register_reboot_notifier(&panel_notifier); --=20 2.50.1.windows.1