Skip to contentSkip to conversation

Fix error handling in backlight drivers

PATCH New Jean Delvare 1 participant 1 message Mar 5, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix error handling in backlight drivers

Hi Jamey, Andrew,

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.

---
 drivers/video/backlight/backlight.c |    2 +-
 drivers/video/backlight/lcd.c       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/backlight.c +1 -1
@@ -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;
drivers/video/backlight/lcd.c +1 -1
@@ -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;
Signature · 1 line
Jean Delvare