[2.6 patch] Fix error handling in backlight drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jean Delvare <[email protected]>

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 <[email protected]>
Signed-off-by: Adrian Bunk <[email protected]>

--- 

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux