* [PATCH] fbdev: au1100fb: Add missing check for clk_enable
@ 2026-01-28 9:10 Chen Ni
2026-01-28 9:40 ` Markus Elfring
2026-01-28 13:29 ` Helge Deller
0 siblings, 2 replies; 8+ messages in thread
From: Chen Ni @ 2026-01-28 9:10 UTC (permalink / raw)
To: deller, u.kleine-koenig, elfring
Cc: linux-fbdev, dri-devel, linux-kernel, Chen Ni
Add check for the return value of clk_enable() andreturn the error
if it fails in order to catch the error.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/video/fbdev/au1100fb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index 6251a6b07b3a..5e7a8f018b7b 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -567,13 +567,16 @@ int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state)
int au1100fb_drv_resume(struct platform_device *dev)
{
struct au1100fb_device *fbdev = platform_get_drvdata(dev);
+ int ret;
if (!fbdev)
return 0;
memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
- clk_enable(fbdev->lcdclk);
+ ret = clk_enable(fbdev->lcdclk);
+ if (ret)
+ return ret;
/* Unblank the LCD */
au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] fbdev: au1100fb: Add missing check for clk_enable
2026-01-28 9:10 [PATCH] fbdev: au1100fb: Add missing check for clk_enable Chen Ni
@ 2026-01-28 9:40 ` Markus Elfring
2026-01-28 13:29 ` Helge Deller
1 sibling, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2026-01-28 9:40 UTC (permalink / raw)
To: Chen Ni, linux-fbdev, dri-devel, Helge Deller, Uwe Kleine-König; +Cc: LKML
> Add check for the return value of clk_enable() andreturn the error
and return?
> if it fails in order to catch the error.
How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc7#n145
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] fbdev: au1100fb: Add missing check for clk_enable
2026-01-28 9:10 [PATCH] fbdev: au1100fb: Add missing check for clk_enable Chen Ni
2026-01-28 9:40 ` Markus Elfring
@ 2026-01-28 13:29 ` Helge Deller
2026-01-28 14:55 ` Uwe Kleine-König
1 sibling, 1 reply; 8+ messages in thread
From: Helge Deller @ 2026-01-28 13:29 UTC (permalink / raw)
To: Chen Ni, u.kleine-koenig, elfring; +Cc: linux-fbdev, dri-devel, linux-kernel
On 1/28/26 10:10, Chen Ni wrote:
> Add check for the return value of clk_enable() andreturn the error
> if it fails in order to catch the error.
Why?
If it really fails, the screen and everything stay blank,
so it's even worse....
It seems nobody is actually checking the return value, most likely
because if it fails, the system will sleep forever anyway.
Or am I missing something?
For now I reject this patch.
Helge
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
> drivers/video/fbdev/au1100fb.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
> index 6251a6b07b3a..5e7a8f018b7b 100644
> --- a/drivers/video/fbdev/au1100fb.c
> +++ b/drivers/video/fbdev/au1100fb.c
> @@ -567,13 +567,16 @@ int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state)
> int au1100fb_drv_resume(struct platform_device *dev)
> {
> struct au1100fb_device *fbdev = platform_get_drvdata(dev);
> + int ret;
>
> if (!fbdev)
> return 0;
>
> memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
>
> - clk_enable(fbdev->lcdclk);
> + ret = clk_enable(fbdev->lcdclk);
> + if (ret)
> + return ret;
>
> /* Unblank the LCD */
> au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] fbdev: au1100fb: Add missing check for clk_enable
2026-01-28 13:29 ` Helge Deller
@ 2026-01-28 14:55 ` Uwe Kleine-König
2026-01-29 4:07 ` [PATCH v2] fbdev: au1100fb: Check return value of clk_enable() in .resume() Chen Ni
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2026-01-28 14:55 UTC (permalink / raw)
To: Helge Deller; +Cc: Chen Ni, elfring, linux-fbdev, dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]
On Wed, Jan 28, 2026 at 02:29:37PM +0100, Helge Deller wrote:
> On 1/28/26 10:10, Chen Ni wrote:
> > Add check for the return value of clk_enable() andreturn the error
> > if it fails in order to catch the error.
>
> Why?
> If it really fails, the screen and everything stay blank,
> so it's even worse....
> It seems nobody is actually checking the return value, most likely
> because if it fails, the system will sleep forever anyway.
> Or am I missing something?
>
> For now I reject this patch.
I think it's the right approach to check the return value. If
au1100fb_drv_resume() fails, the system as a whole will still be
up and it will know that the fb failed to resume.
With the status quo it will assume it's properly resumed despite it
didn't.
Still there are some things so criticise:
- s/Add missing check for clk_enable/Check return value of clk_enable() in .resume().
- s/ / /
While looking at the driver I spotted another issue: There is a single
static struct au1100fb_regs fbregs;
to store the register values. This only works if there are <= 1 such
devices (and wastes memory if there is no such device).
Usually there is at most one such device, but it's cheap to move the
struct into struct au1100fb_device, and if it's only to make the driver
a better template for new drivers.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] fbdev: au1100fb: Check return value of clk_enable() in .resume()
2026-01-28 14:55 ` Uwe Kleine-König
@ 2026-01-29 4:07 ` Chen Ni
2026-01-29 7:13 ` Uwe Kleine-König
2026-01-29 7:36 ` Markus Elfring
0 siblings, 2 replies; 8+ messages in thread
From: Chen Ni @ 2026-01-29 4:07 UTC (permalink / raw)
To: u.kleine-koenig
Cc: deller, dri-devel, elfring, linux-fbdev, linux-kernel, Chen Ni
Check the return value of clk_enable() in au1100fb_drv_resume() and
return the error on failure.
This ensures the system is aware of the resume failure and can track
its state accurately.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
Changes in v2:
- Update commit message
- Clean up extraneous whitespace in the code
---
drivers/video/fbdev/au1100fb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c
index 6251a6b07b3a..feaa1061c436 100644
--- a/drivers/video/fbdev/au1100fb.c
+++ b/drivers/video/fbdev/au1100fb.c
@@ -567,13 +567,16 @@ int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state)
int au1100fb_drv_resume(struct platform_device *dev)
{
struct au1100fb_device *fbdev = platform_get_drvdata(dev);
+ int ret;
if (!fbdev)
return 0;
memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs));
- clk_enable(fbdev->lcdclk);
+ ret = clk_enable(fbdev->lcdclk);
+ if (ret)
+ return ret;
/* Unblank the LCD */
au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info);
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH v2] fbdev: au1100fb: Check return value of clk_enable() in .resume()
2026-01-29 4:07 ` [PATCH v2] fbdev: au1100fb: Check return value of clk_enable() in .resume() Chen Ni
@ 2026-01-29 7:13 ` Uwe Kleine-König
2026-01-29 7:45 ` Helge Deller
2026-01-29 7:36 ` Markus Elfring
1 sibling, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2026-01-29 7:13 UTC (permalink / raw)
To: Chen Ni; +Cc: deller, dri-devel, elfring, linux-fbdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 385 bytes --]
On Thu, Jan 29, 2026 at 12:07:14PM +0800, Chen Ni wrote:
> Check the return value of clk_enable() in au1100fb_drv_resume() and
> return the error on failure.
> This ensures the system is aware of the resume failure and can track
> its state accurately.
>
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Thanks
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] fbdev: au1100fb: Check return value of clk_enable() in .resume()
2026-01-29 7:13 ` Uwe Kleine-König
@ 2026-01-29 7:45 ` Helge Deller
0 siblings, 0 replies; 8+ messages in thread
From: Helge Deller @ 2026-01-29 7:45 UTC (permalink / raw)
To: Uwe Kleine-König, Chen Ni
Cc: dri-devel, elfring, linux-fbdev, linux-kernel
On 1/29/26 08:13, Uwe Kleine-König wrote:
> On Thu, Jan 29, 2026 at 12:07:14PM +0800, Chen Ni wrote:
>> Check the return value of clk_enable() in au1100fb_drv_resume() and
>> return the error on failure.
>> This ensures the system is aware of the resume failure and can track
>> its state accurately.
>>
>> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
>
> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Applied to fbdev git tree.
Uwe, thanks for feedback & double-checking!
Helge
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] fbdev: au1100fb: Check return value of clk_enable() in .resume()
2026-01-29 4:07 ` [PATCH v2] fbdev: au1100fb: Check return value of clk_enable() in .resume() Chen Ni
2026-01-29 7:13 ` Uwe Kleine-König
@ 2026-01-29 7:36 ` Markus Elfring
1 sibling, 0 replies; 8+ messages in thread
From: Markus Elfring @ 2026-01-29 7:36 UTC (permalink / raw)
To: Chen Ni, linux-fbdev, dri-devel; +Cc: LKML, Helge Deller, Uwe Kleine-König
> Check the return value of clk_enable() in au1100fb_drv_resume() and
> return the error on failure.
Were any source code analysis tools involved here?
> This ensures the system is aware of the resume failure and can track
Ensure?
> its state accurately.
Did anything hinder to add any tags (like “Fixes” and “Cc”) accordingly?
Regards,
Markus
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-01-29 7:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-28 9:10 [PATCH] fbdev: au1100fb: Add missing check for clk_enable Chen Ni
2026-01-28 9:40 ` Markus Elfring
2026-01-28 13:29 ` Helge Deller
2026-01-28 14:55 ` Uwe Kleine-König
2026-01-29 4:07 ` [PATCH v2] fbdev: au1100fb: Check return value of clk_enable() in .resume() Chen Ni
2026-01-29 7:13 ` Uwe Kleine-König
2026-01-29 7:45 ` Helge Deller
2026-01-29 7:36 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®