Skip to contentSkip to conversation

cklight: tps65217_bl: Remove unnecessary default brightness check

PATCH In review Christos Gkekas 4 participants 4 messages Oct 8, 2017 – Oct 13, 2017

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

PATCH 1/1 cklight: tps65217_bl: Remove unnecessary default brightness check

Variable val holds the default brightness and is unsigned, therefore checking whether it is less than zero is redundant.

---
 drivers/video/backlight/tps65217_bl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/backlight/tps65217_bl.c +1 -2
index fd524ad..61ea82d 100644
@@ -239,8 +239,7 @@ tps65217_bl_parse_dt(struct platform_device *pdev)
 	}
 
 	if (!of_property_read_u32(node, "default-brightness", &val)) {
-		if (val < 0 ||
-			val > 100) {
+		if (val > 100) {
 			dev_err(&pdev->dev,
 				"invalid 'default-brightness' value in the device tree\n");
 			err = ERR_PTR(-EINVAL);
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Christos Gkekas

Variable val holds the default brightness and is unsigned, therefore checking whether it is less than zero is redundant.

Quoted 19 lines
---
  drivers/video/backlight/tps65217_bl.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/backlight/tps65217_bl.c +1 -2
index fd524ad..61ea82d 100644
@@ -239,8 +239,7 @@ tps65217_bl_parse_dt(struct platform_device *pdev)
  	}
 
  	if (!of_property_read_u32(node, "default-brightness", &val)) {
-		if (val < 0 ||
-			val > 100) {
+		if (val > 100) {
  			dev_err(&pdev->dev,
  				"invalid 'default-brightness' value in the device tree\n");
  			err = ERR_PTR(-EINVAL);
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Christos Gkekas
Quoted 5 lines · Christos Gkekas

Variable val holds the default brightness and is unsigned, therefore checking whether it is less than zero is redundant.

It looks good.

Best regards,
Jingoo Han

Quoted 22 lines
---
 drivers/video/backlight/tps65217_bl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/backlight/tps65217_bl.c +1 -2
index fd524ad..61ea82d 100644
@@ -239,8 +239,7 @@ tps65217_bl_parse_dt(struct platform_device *pdev)
 	}
 
 	if (!of_property_read_u32(node, "default-brightness", &val)) {
-		if (val < 0 ||
-			val > 100) {
+		if (val > 100) {
 			dev_err(&pdev->dev,
 				"invalid 'default-brightness' value in the
 device tree\n");

err = ERR_PTR(-EINVAL);
--
2.7.4

#3 lore raw
In reply to Christos Gkekas
Quoted 7 lines · Christos Gkekas

Variable val holds the default brightness and is unsigned, therefore checking whether it is less than zero is redundant.

---
 drivers/video/backlight/tps65217_bl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Subject line fixed and patch applied, thanks.

Quoted 14 lines
drivers/video/backlight/tps65217_bl.c +1 -2
index fd524ad..61ea82d 100644
@@ -239,8 +239,7 @@ tps65217_bl_parse_dt(struct platform_device *pdev)
 	}
 
 	if (!of_property_read_u32(node, "default-brightness", &val)) {
-		if (val < 0 ||
-			val > 100) {
+		if (val > 100) {
 			dev_err(&pdev->dev,
 				"invalid 'default-brightness' value in the device tree\n");
 			err = ERR_PTR(-EINVAL);
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog