Skip to contentSkip to conversation

backlight: aat2870_bl: fix error checking for backlight_device_register

PATCH New Axel Lin 1 participant 1 message Jul 6, 2011

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 backlight: aat2870_bl: fix error checking for backlight_device_register

backlight_device_register() returns ERR_PTR() on error.

---
 drivers/video/backlight/aat2870_bl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/aat2870_bl.c +2 -2
index 4952a61..f13a3f7 100644
@@ -158,10 +158,10 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 	props.type = BACKLIGHT_RAW;
 	bd = backlight_device_register("aat2870-backlight", &pdev->dev,
 				       aat2870_bl, &aat2870_bl_ops, &props);
-	if (!bd) {
+	if (IS_ERR(bd)) {
 		dev_err(&pdev->dev,
 			"Failed allocate memory for backlight device\n");
-		ret = -ENOMEM;
+		ret = PTR_ERR(bd);
 		goto out_kfree;
 	}
 
Signature · 1 line
1.7.4.1