* [PATCH v2 1/2] regulator: anatop-regulator: Only jump to 'anatop_probe_end' on error
@ 2013-12-21 19:27 Fabio Estevam
2013-12-21 19:27 ` [PATCH v2 2/2] regulator: anatop-regulator: Remove unneeded variable Fabio Estevam
2013-12-23 8:24 ` [PATCH v2 1/2] regulator: anatop-regulator: Only jump to 'anatop_probe_end' on error Shawn Guo
0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2013-12-21 19:27 UTC (permalink / raw)
To: broonie; +Cc: shawn.guo, Anson.Huang, linux-kernel, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
Currently 'anatop_probe_end' path is executed on both succesfull and error paths
of anatop_regulator_probe().
To let the code a bit clearer, make 'anatop_probe_end' to be executed only when
an error happens.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/regulator/anatop-regulator.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index c734d09..53e6048 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -210,9 +210,10 @@ static int anatop_regulator_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rdev);
+ return 0;
+
anatop_probe_end:
- if (ret)
- kfree(sreg->name);
+ kfree(sreg->name);
return ret;
}
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] regulator: anatop-regulator: Remove unneeded variable
2013-12-21 19:27 [PATCH v2 1/2] regulator: anatop-regulator: Only jump to 'anatop_probe_end' on error Fabio Estevam
@ 2013-12-21 19:27 ` Fabio Estevam
2013-12-23 8:24 ` [PATCH v2 1/2] regulator: anatop-regulator: Only jump to 'anatop_probe_end' on error Shawn Guo
1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2013-12-21 19:27 UTC (permalink / raw)
To: broonie; +Cc: shawn.guo, Anson.Huang, linux-kernel, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
There is no need to create a local variable for accessing sreg->name.
Access it directly instead.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- None
drivers/regulator/anatop-regulator.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 53e6048..8fee74d 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -222,9 +222,8 @@ static int anatop_regulator_remove(struct platform_device *pdev)
{
struct regulator_dev *rdev = platform_get_drvdata(pdev);
struct anatop_regulator *sreg = rdev_get_drvdata(rdev);
- const char *name = sreg->name;
- kfree(name);
+ kfree(sreg->name);
return 0;
}
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] regulator: anatop-regulator: Only jump to 'anatop_probe_end' on error
2013-12-21 19:27 [PATCH v2 1/2] regulator: anatop-regulator: Only jump to 'anatop_probe_end' on error Fabio Estevam
2013-12-21 19:27 ` [PATCH v2 2/2] regulator: anatop-regulator: Remove unneeded variable Fabio Estevam
@ 2013-12-23 8:24 ` Shawn Guo
1 sibling, 0 replies; 3+ messages in thread
From: Shawn Guo @ 2013-12-23 8:24 UTC (permalink / raw)
To: Fabio Estevam; +Cc: broonie, Anson.Huang, linux-kernel, Fabio Estevam
On Sat, Dec 21, 2013 at 05:27:25PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Currently 'anatop_probe_end' path is executed on both succesfull and error paths
> of anatop_regulator_probe().
>
> To let the code a bit clearer, make 'anatop_probe_end' to be executed only when
> an error happens.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/regulator/anatop-regulator.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
> index c734d09..53e6048 100644
> --- a/drivers/regulator/anatop-regulator.c
> +++ b/drivers/regulator/anatop-regulator.c
> @@ -210,9 +210,10 @@ static int anatop_regulator_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, rdev);
>
> + return 0;
> +
> anatop_probe_end:
> - if (ret)
> - kfree(sreg->name);
> + kfree(sreg->name);
While you're there, you may wan to fix the return check of of_get_parent() in
anatop_regulator_probe() as well.
Shawn
>
> return ret;
> }
> --
> 1.8.1.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-23 8:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-21 19:27 [PATCH v2 1/2] regulator: anatop-regulator: Only jump to 'anatop_probe_end' on error Fabio Estevam
2013-12-21 19:27 ` [PATCH v2 2/2] regulator: anatop-regulator: Remove unneeded variable Fabio Estevam
2013-12-23 8:24 ` [PATCH v2 1/2] regulator: anatop-regulator: Only jump to 'anatop_probe_end' on error Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).