devfreq: separate error paths from successful path
MyungJoo Ham
Acked-bySender : Axel Lin<[email protected]> Date : 2011-11-10 16:30 (GMT+09:00)
Quoted 3 lines
I think this change improves readability.
Signed-off-by Axel Lin
I agree. It makes it easier to read.
Quoted 48 lines
---
drivers/devfreq/devfreq.c| 15 +++++++--------1 files changed, 7 insertions(+), 8 deletions(-)drivers/devfreq/devfreq.c +5
-3@@ -347,7 +347,7 @@ struct devfreq *devfreq_add_device(struct device *dev,if (!IS_ERR (devfreq)) {dev_err (dev,"%s: Unable to create devfreq for the device. It already has one. " , __func__); err = -EINVAL ; - goto out; + goto err_out; } }@@ -356,7 +356,7 @@ struct devfreq *devfreq_add_device(struct device *dev,dev_err (dev,"%s: Unable to create devfreq for the device " , __func__); err = -ENOMEM ; - goto out; + goto err_out; }mutex_init (&devfreq->lock);@@ -399,17 +399,16 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->next_polling); }mutex_unlock (&devfreq_list_lock); - goto out; +out: +return devfreq; +
err_init:device_unregister(&devfreq->dev);err_dev:mutex_unlock(&devfreq->lock);
kfree(devfreq);drivers/devfreq/devfreq.c +2
-5-out: -if (err) -return ERR_PTR (err); -else -return devfreq; +err_out: +return ERR_PTR (err);}
Quoted 4 lines
/**
Signature · 1 line
1.7.5.4
�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m����띠�◀?뻀�
Rafael J. Wysocki
AppliedQuoted 8 lines · MyungJoo Ham
Sender : Axel Lin<[email protected]> Date : 2011-11-10 16:30 (GMT+09:00)
Quoted 3 lines
I think this change improves readability.
Signed-off-by Axel LinI agree. It makes it easier to read.
Acked-by MyungJoo Ham <[email protected]>
Applied to linux-pm/pm-fixes.
Thanks,
Rafael
Quoted 50 lines
Quoted 49 lines
---
drivers/devfreq/devfreq.c| 15 +++++++--------1 files changed, 7 insertions(+), 8 deletions(-)drivers/devfreq/devfreq.c +5
-3@@ -347,7 +347,7 @@ struct devfreq *devfreq_add_device(struct device *dev,if (!IS_ERR (devfreq)) {dev_err (dev,"%s: Unable to create devfreq for the device. It already has one. " , __func__); err = -EINVAL ; - goto out; + goto err_out; } }@@ -356,7 +356,7 @@ struct devfreq *devfreq_add_device(struct device *dev,dev_err (dev,"%s: Unable to create devfreq for the device " , __func__); err = -ENOMEM ; - goto out; + goto err_out; }mutex_init (&devfreq->lock);@@ -399,17 +399,16 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->next_polling); }mutex_unlock (&devfreq_list_lock); - goto out; +out: +return devfreq; +
err_init:device_unregister(&devfreq->dev);err_dev:mutex_unlock(&devfreq->lock);
kfree(devfreq);drivers/devfreq/devfreq.c +2
-5-out: -if (err) -return ERR_PTR (err); -else -return devfreq; +err_out: +return ERR_PTR (err);}
/**
Quoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · MyungJoo Ham
Sender : Axel Lin<[email protected]> Date : 2011-11-10 16:30 (GMT+09:00)
Quoted 3 lines
I think this change improves readability.
Signed-off-by Axel LinI agree. It makes it easier to read.
Acked-by MyungJoo Ham <[email protected]>Applied to linux-pm/pm-fixes.
Sorry, this one went to linux-pm/linux-next and will wait for the 3.3 merge window.
Thanks,
Rafael
Quoted 58 lines
Quoted 48 lines
Quoted 48 lines
---
drivers/devfreq/devfreq.c| 15 +++++++--------1 files changed, 7 insertions(+), 8 deletions(-)drivers/devfreq/devfreq.c +5
-3@@ -347,7 +347,7 @@ struct devfreq *devfreq_add_device(struct device *dev,if (!IS_ERR (devfreq)) {dev_err (dev,"%s: Unable to create devfreq for the device. It already has one. " , __func__); err = -EINVAL ; - goto out; + goto err_out; } }@@ -356,7 +356,7 @@ struct devfreq *devfreq_add_device(struct device *dev,dev_err (dev,"%s: Unable to create devfreq for the device " , __func__); err = -ENOMEM ; - goto out; + goto err_out; }mutex_init (&devfreq->lock);@@ -399,17 +399,16 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->next_polling); }mutex_unlock (&devfreq_list_lock); - goto out; +out: +return devfreq; +
err_init:device_unregister(&devfreq->dev);err_dev:mutex_unlock(&devfreq->lock);
kfree(devfreq);drivers/devfreq/devfreq.c +2
-5-out: -if (err) -return ERR_PTR (err); -else -return devfreq; +err_out: +return ERR_PTR (err);}
Quoted 2 lines
Quoted 1 line
/**
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/