[2.6 patch] Fix error handling in backlight drivers



From: Jean Delvare <khali@xxxxxxxxxxxx>

I have spotted the following problem in the way the backlight and lcd
drivers handle out-of-memory errors. This should probably be fixed for
2.6.16. Note that I don't have supported hardware so I couldn't
actually test the fix.


ERR_PTR() is supposed to be passed a negative value.

Signed-off-by: Jean Delvare <khali@xxxxxxxxxxxx>
Signed-off-by: Adrian Bunk <bunk@xxxxxxxxx>

---

This patch was sent by Jean Delvare on:
- 5 Mar 2006

drivers/video/backlight/backlight.c | 2 +-
drivers/video/backlight/lcd.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

--- linux-2.6.16-rc5.orig/drivers/video/backlight/backlight.c 2006-02-13 19:22:18.000000000 +0100
+++ linux-2.6.16-rc5/drivers/video/backlight/backlight.c 2006-03-05 18:39:58.000000000 +0100
@@ -172,7 +172,7 @@

new_bd = kmalloc(sizeof(struct backlight_device), GFP_KERNEL);
if (unlikely(!new_bd))
- return ERR_PTR(ENOMEM);
+ return ERR_PTR(-ENOMEM);

init_MUTEX(&new_bd->sem);
new_bd->props = bp;
--- linux-2.6.16-rc5.orig/drivers/video/backlight/lcd.c 2006-02-13 19:22:18.000000000 +0100
+++ linux-2.6.16-rc5/drivers/video/backlight/lcd.c 2006-03-05 18:39:54.000000000 +0100
@@ -171,7 +171,7 @@

new_ld = kmalloc(sizeof(struct lcd_device), GFP_KERNEL);
if (unlikely(!new_ld))
- return ERR_PTR(ENOMEM);
+ return ERR_PTR(-ENOMEM);

init_MUTEX(&new_ld->sem);
new_ld->props = lp;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • [PATCH] Fix error handling in backlight drivers
    ... I have spotted the following problem in the way the backlight and lcd ... drivers handle out-of-memory errors. ...
    (Linux-Kernel)
  • Backlight and LCD module patches [2]
    ... This patch adds lcd and backlight driver classes so that the ... +struct lcd_properties { ... * class is registered before users of the class try to register lcd's ...
    (Linux-Kernel)
  • Re: LCD Monitor has very low display quality at 800x600 setting
    ... condition that is effected by a flickering fluorescent light ... light behind the LCD display and that is how it works. ... Try turning the backlight off and use ... to the NEC ...
    (microsoft.public.windowsxp.hardware)
  • [PATCH] fbdev: Statically link the framebuffer notification functions
    ... The backlight and lcd subsystems can be notified by the framebuffer layer ... separate out the framebuffer notification mechanism from the ...
    (Linux-Kernel)
  • Re: Inspiron 6000 Backlight Replacement
    ... I have not determined the exact problem but am wondering if replacing a backlight is something an intermediate computer tinkerer can do. ... I have no reservations about taking apart notebooks and if the backlight is the problem replacing it would be way cheaper than a $150 to $300 LCD... ... Don't know if the Inspiron 6000 has an nVidia chip or whether it is part of the motherboard or part of a separate snap-on proprietary graphics card. ... It may also be that either the backlight connector is loose inside the LCD screen or that the cable connecting to the laptop motherboard is simply loose. ...
    (alt.sys.pc-clone.dell)