iio: tsl2772: Use devm_add_action_or_reset
PATCH v4 1/4 iio: tsl2772: Use devm_add_action_or_reset
Use devm_add_action_or_reset to remove the call to tsl2772_disable_regulators_action to simplify the error path.
---
Changes in v4:
- Split v3 into three patches.
- Revise description to make it more precise.
drivers/iio/light/tsl2772.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/light/tsl2772.c +3 -3
@@ -1807,10 +1807,10 @@ static int tsl2772_probe(struct i2c_client *clientp,return PTR_ERR (chip->vdd_supply); } - ret =devm_add_action (&clientp->dev, tsl2772_disable_regulators_action, - chip); + ret =devm_add_action_or_reset (&clientp->dev, + tsl2772_disable_regulators_action, + chip);if (ret <0 ) { -tsl2772_disable_regulators_action (chip);dev_err (&clientp->dev,"Failed to setup regulator cleanup action %d\n" , ret);return ret;
Signature · 1 line
2.20.1
Quoted 4 lines · Chuhong Yuan
Use
devm_add_action_or_resetto remove the call totsl2772_disable_regulators_actionto simplify the error path.Signed-off-by Chuhong Yuan <[email protected]>
For the whole series:
I forgot to mention this before, but next time please use a cover letter if you're sending more than one patch: git format-patch --cover-letter.
Brian
Quoted 28 lines
---
Changes in v4:
- Split v3 into three patches.
- Revise description to make it more precise.drivers/iio/light/tsl2772.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/iio/light/tsl2772.c +3
-3@@ -1807,10 +1807,10 @@ static int tsl2772_probe(struct i2c_client *clientp,return PTR_ERR (chip->vdd_supply); } - ret =devm_add_action (&clientp->dev, tsl2772_disable_regulators_action, - chip); + ret =devm_add_action_or_reset (&clientp->dev, + tsl2772_disable_regulators_action, + chip);if (ret <0 ) { -tsl2772_disable_regulators_action (chip);dev_err (&clientp->dev,"Failed to setup regulator cleanup action %d\n" , ret);return ret;Signature · 1 line
2.20.1
Brian Masney
Tested-byQuoted 9 lines · Brian Masney
Quoted 4 lines · Chuhong Yuan
Use
devm_add_action_or_resetto remove the call totsl2772_disable_regulators_actionto simplify the error path.Signed-off-by Chuhong Yuan <[email protected]>For the whole series:
Reviewed-by Brian Masney <[email protected]>
Oops, I forgot to add this as well:
I tested this on a Nexus 5 phone.
Brian
Quoted 35 lines
I forgot to mention this before, but next time please use a cover letter if you're sending more than one patch: git format-patch --cover-letter.
Brian
Quoted 28 lines
---
Changes in v4:
- Split v3 into three patches.
- Revise description to make it more precise.drivers/iio/light/tsl2772.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/iio/light/tsl2772.c +3
-3@@ -1807,10 +1807,10 @@ static int tsl2772_probe(struct i2c_client *clientp,return PTR_ERR (chip->vdd_supply); } - ret =devm_add_action (&clientp->dev, tsl2772_disable_regulators_action, - chip); + ret =devm_add_action_or_reset (&clientp->dev, + tsl2772_disable_regulators_action, + chip);if (ret <0 ) { -tsl2772_disable_regulators_action (chip);dev_err (&clientp->dev,"Failed to setup regulator cleanup action %d\n" , ret);return ret;Signature · 1 line
2.20.1
Jonathan Cameron
maintainerQuoted 11 lines · On Thu, 1 Aug 2019 05:37:31 -0400 Brian Masney <[email protected]> wrote:
Quoted 9 lines · Brian Masney
Quoted 4 lines · Chuhong Yuan
Use
devm_add_action_or_resetto remove the call totsl2772_disable_regulators_actionto simplify the error path.Signed-off-by Chuhong Yuan <[email protected]>For the whole series:
Reviewed-by Brian Masney <[email protected]>
Quoted 8 lines
Oops, I forgot to add this as well:
Tested-by Brian Masney <[email protected]>I tested this on a Nexus 5 phone.
Brian
Applied to the togreg branch of iio.git and pushed out as testing.
Now the fact we have a fix in the middle of this series is a bit unfortunate as it'll mean we need an explicit backport to take that for stable.
Oh well, if anyone wants it up to them to do the work ;)
Thanks,
Jonathan
Quoted 36 lines
Quoted 36 lines
I forgot to mention this before, but next time please use a cover letter if you're sending more than one patch: git format-patch --cover-letter.
Brian
Quoted 28 lines
---
Changes in v4:
- Split v3 into three patches.
- Revise description to make it more precise.drivers/iio/light/tsl2772.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/iio/light/tsl2772.c +3
-3@@ -1807,10 +1807,10 @@ static int tsl2772_probe(struct i2c_client *clientp,return PTR_ERR (chip->vdd_supply); } - ret =devm_add_action (&clientp->dev, tsl2772_disable_regulators_action, - chip); + ret =devm_add_action_or_reset (&clientp->dev, + tsl2772_disable_regulators_action, + chip);if (ret <0 ) { -tsl2772_disable_regulators_action (chip);dev_err (&clientp->dev,"Failed to setup regulator cleanup action %d\n" , ret);return ret;Signature · 1 line
2.20.1