Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

backlight: sky81452: Remove unneeded use of IS_ERR_VALUE() macro

IS_ERR_VALUE() makes sense only *if* there could be valid values in
negative error range.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Axel Lin and committed by
Lee Jones
047ffbb2 7ddbc242

+13 -13
+13 -13
drivers/video/backlight/sky81452-backlight.c
··· 65 65 66 66 if (brightness > 0) { 67 67 ret = regmap_write(regmap, SKY81452_REG0, brightness - 1); 68 - if (IS_ERR_VALUE(ret)) 68 + if (ret < 0) 69 69 return ret; 70 70 71 71 return regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN, ··· 87 87 int ret; 88 88 89 89 ret = kstrtoul(buf, 16, &value); 90 - if (IS_ERR_VALUE(ret)) 90 + if (ret < 0) 91 91 return ret; 92 92 93 93 ret = regmap_update_bits(regmap, SKY81452_REG1, SKY81452_EN, 94 94 value << CTZ(SKY81452_EN)); 95 - if (IS_ERR_VALUE(ret)) 95 + if (ret < 0) 96 96 return ret; 97 97 98 98 return count; ··· 108 108 109 109 reg = !strcmp(attr->attr.name, "open") ? SKY81452_REG5 : SKY81452_REG4; 110 110 ret = regmap_read(regmap, reg, &value); 111 - if (IS_ERR_VALUE(ret)) 111 + if (ret < 0) 112 112 return ret; 113 113 114 114 if (value & SKY81452_SHRT) { ··· 136 136 int ret; 137 137 138 138 ret = regmap_read(regmap, SKY81452_REG4, &value); 139 - if (IS_ERR_VALUE(ret)) 139 + if (ret < 0) 140 140 return ret; 141 141 142 142 *buf = 0; ··· 196 196 pdata->gpio_enable = of_get_gpio(np, 0); 197 197 198 198 ret = of_property_count_u32_elems(np, "led-sources"); 199 - if (IS_ERR_VALUE(ret)) { 199 + if (ret < 0) { 200 200 pdata->enable = SKY81452_EN >> CTZ(SKY81452_EN); 201 201 } else { 202 202 num_entry = ret; ··· 205 205 206 206 ret = of_property_read_u32_array(np, "led-sources", sources, 207 207 num_entry); 208 - if (IS_ERR_VALUE(ret)) { 208 + if (ret < 0) { 209 209 dev_err(dev, "led-sources node is invalid.\n"); 210 210 return ERR_PTR(-EINVAL); 211 211 } ··· 218 218 ret = of_property_read_u32(np, 219 219 "skyworks,short-detection-threshold-volt", 220 220 &pdata->short_detection_threshold); 221 - if (IS_ERR_VALUE(ret)) 221 + if (ret < 0) 222 222 pdata->short_detection_threshold = 7; 223 223 224 224 ret = of_property_read_u32(np, "skyworks,current-limit-mA", 225 225 &pdata->boost_current_limit); 226 - if (IS_ERR_VALUE(ret)) 226 + if (ret < 0) 227 227 pdata->boost_current_limit = 2750; 228 228 229 229 of_node_put(np); ··· 278 278 if (gpio_is_valid(pdata->gpio_enable)) { 279 279 ret = devm_gpio_request_one(dev, pdata->gpio_enable, 280 280 GPIOF_OUT_INIT_HIGH, "sky81452-en"); 281 - if (IS_ERR_VALUE(ret)) { 281 + if (ret < 0) { 282 282 dev_err(dev, "failed to request GPIO. err=%d\n", ret); 283 283 return ret; 284 284 } 285 285 } 286 286 287 287 ret = sky81452_bl_init_device(regmap, pdata); 288 - if (IS_ERR_VALUE(ret)) { 288 + if (ret < 0) { 289 289 dev_err(dev, "failed to initialize. err=%d\n", ret); 290 290 return ret; 291 291 } ··· 302 302 303 303 platform_set_drvdata(pdev, bd); 304 304 305 - ret = sysfs_create_group(&bd->dev.kobj, &sky81452_bl_attr_group); 306 - if (IS_ERR_VALUE(ret)) { 305 + ret = sysfs_create_group(&bd->dev.kobj, &sky81452_bl_attr_group); 306 + if (ret < 0) { 307 307 dev_err(dev, "failed to create attribute. err=%d\n", ret); 308 308 return ret; 309 309 }