backlight: lp855x: remove goto err_dev
Subsystems (2)
PATCH 3/3 backlight: lp855x: remove goto err_dev
This patch removes goto err_dev, which makes code a bit smaller.
Cc Milo(Woogyom) Kim <[email protected]>
Cc Richard Purdie <[email protected]>
Signed-off-by Jingoo Han <[email protected]>
--- drivers/video/backlight/lp855x_bl.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/video/backlight/lp855x_bl.c +2 -3
@@ -272,14 +272,14 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)if (ret) {dev_err (lp->dev,"i2c communication err: %d" , ret);if (mode ==REGISTER_BASED ) - goto err_dev; +return ret; } ret =lp855x_backlight_register (lp);if (ret) {dev_err (lp->dev,"failed to register backlight. err: %d\n" , ret); - goto err_dev; +return ret; } ret =sysfs_create_group (&lp->dev->kobj, &lp855x_attr_group);
@@ -293,7 +293,6 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id) err_sysfs:lp855x_backlight_unregister (lp); -err_dev:return ret; }
Signature · 1 line
1.7.1
Quoted 1 line
This patch removes goto
err_dev, which makes code a bit smaller.
Thanks !
IMO, goto statements are meaningful on _probe().
However, 'goto err_sysfs' also can be removed if the size of code is critical.
drivers/video/backlight/lp855x_bl.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
drivers/video/backlight/lp855x_bl.c +4 -8
@@ -268,29 +268,25 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)if (ret) {dev_err (lp->dev,"i2c communication err: %d" , ret);if (mode ==REGISTER_BASED ) - goto err_dev; +return ret; } ret =lp855x_backlight_register (lp);if (ret) {dev_err (lp->dev,"failed to register backlight. err: %d\n" , ret); - goto err_dev; +return ret; } ret =sysfs_create_group (&lp->dev->kobj, &lp855x_attr_group);if (ret) {dev_err (lp->dev,"failed to register sysfs. err: %d\n" , ret); - goto err_sysfs; +lp855x_backlight_unregister (lp); +return ret; }backlight_update_status (lp->bl);return 0 ; - -err_sysfs: -lp855x_backlight_unregister (lp); -err_dev: -return ret; } static int __devexit lp855x_remove(struct i2c_client *cl)
Signature · 4 lines
1.7.2.5 Best Regards, Milo
Quoted 6 lines · Milo
Quoted 2 lines
This patch removes goto
err_dev, which makes code a bit smaller.Thanks !
IMO, goto statements are meaningful on_probe().
However, 'gotoerr_sysfs' also can be removed if the size of code is critical.
OK, I will send v2 patch.
Best regards,
Jingoo Han
Quoted 47 lines
drivers/video/backlight/lp855x_bl.c| 12 ++++--------1 files changed, 4 insertions(+), 8 deletions(-)drivers/video/backlight/lp855x_bl.c +4
-9@@ -268,29 +268,25 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)if (ret) {dev_err (lp->dev,"i2c communication err: %d" , ret);if (mode ==REGISTER_BASED ) - goto err_dev; +return ret; } ret =lp855x_backlight_register (lp);if (ret) {dev_err (lp->dev,"failed to register backlight. err: %d\n" , ret); - goto err_dev; +return ret; } ret =sysfs_create_group (&lp->dev->kobj, &lp855x_attr_group);if (ret) {dev_err (lp->dev,"failed to register sysfs. err: %d\n" , ret); - goto err_sysfs; +lp855x_backlight_unregister (lp); +return ret; }backlight_update_status (lp->bl);return 0 ; - -err_sysfs: -lp855x_backlight_unregister (lp); -err_dev: -return ret; } static int __devexit lp855x_remove(struct i2c_client *cl) --1.7.2.5
Best Regards,
Milo