[5/5] bus: ti-sysc: Simplify cleanup upon failures in sysc_probe()

Message ID 20190625233315.22301-6-s-anna@ti.com
State New
Headers show
Series
  • Untitled series #21455
Related show

Commit Message

Suman Anna June 25, 2019, 11:33 p.m.
The clocks are not yet parsed and prepared until after a successful
sysc_get_clocks(), so there is no need to unprepare the clocks upon
any failure of any of the prior functions in sysc_probe(). The current
code path would have been a no-op because of the clock validity checks
within sysc_unprepare(), but let's just simplify the cleanup path by
returning the error directly.

While at this, also fix the cleanup path for a sysc_init_resets()
failure which is executed after the clocks are prepared.

Signed-off-by: Suman Anna <s-anna@ti.com>

---
 drivers/bus/ti-sysc.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
2.21.0

Comments

Tony Lindgren June 27, 2019, 12:11 p.m. | #1
Hi,

* Suman Anna <s-anna@ti.com> [190625 23:33]:
> The clocks are not yet parsed and prepared until after a successful

> sysc_get_clocks(), so there is no need to unprepare the clocks upon

> any failure of any of the prior functions in sysc_probe(). The current

> code path would have been a no-op because of the clock validity checks

> within sysc_unprepare(), but let's just simplify the cleanup path by

> returning the error directly.

> 

> While at this, also fix the cleanup path for a sysc_init_resets()

> failure which is executed after the clocks are prepared.


Sounds like this should get queued separately as a fix for v5.3-rc
cycle, probably got broken with the recent ti-sysc init order changes.

Regards,

Tony
Suman Anna June 27, 2019, 3:24 p.m. | #2
On 6/27/19 7:11 AM, Tony Lindgren wrote:
> Hi,

> 

> * Suman Anna <s-anna@ti.com> [190625 23:33]:

>> The clocks are not yet parsed and prepared until after a successful

>> sysc_get_clocks(), so there is no need to unprepare the clocks upon

>> any failure of any of the prior functions in sysc_probe(). The current

>> code path would have been a no-op because of the clock validity checks

>> within sysc_unprepare(), but let's just simplify the cleanup path by

>> returning the error directly.

>>

>> While at this, also fix the cleanup path for a sysc_init_resets()

>> failure which is executed after the clocks are prepared.

> 

> Sounds like this should get queued separately as a fix for v5.3-rc

> cycle, probably got broken with the recent ti-sysc init order changes.


Yeah, this patch does not depend on the previous 4 patches, so can be
picked up independently for v5.3-rc as well.

regards
Suman
Tony Lindgren Aug. 13, 2019, 10:59 a.m. | #3
* Suman Anna <s-anna@ti.com> [190627 15:24]:
> On 6/27/19 7:11 AM, Tony Lindgren wrote:

> > Hi,

> > 

> > * Suman Anna <s-anna@ti.com> [190625 23:33]:

> >> The clocks are not yet parsed and prepared until after a successful

> >> sysc_get_clocks(), so there is no need to unprepare the clocks upon

> >> any failure of any of the prior functions in sysc_probe(). The current

> >> code path would have been a no-op because of the clock validity checks

> >> within sysc_unprepare(), but let's just simplify the cleanup path by

> >> returning the error directly.

> >>

> >> While at this, also fix the cleanup path for a sysc_init_resets()

> >> failure which is executed after the clocks are prepared.

> > 

> > Sounds like this should get queued separately as a fix for v5.3-rc

> > cycle, probably got broken with the recent ti-sysc init order changes.

> 

> Yeah, this patch does not depend on the previous 4 patches, so can be

> picked up independently for v5.3-rc as well.


OK applying the $subject patch into fixes, and the rest into
omap-for-v5.4/ti-sysc.

Regards,

Tony

Patch

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index ccdd1f0871f9..a7e704e0840d 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -2384,27 +2384,27 @@  static int sysc_probe(struct platform_device *pdev)
 
 	error = sysc_init_dts_quirks(ddata);
 	if (error)
-		goto unprepare;
+		return error;
 
 	error = sysc_map_and_check_registers(ddata);
 	if (error)
-		goto unprepare;
+		return error;
 
 	error = sysc_init_sysc_mask(ddata);
 	if (error)
-		goto unprepare;
+		return error;
 
 	error = sysc_init_idlemodes(ddata);
 	if (error)
-		goto unprepare;
+		return error;
 
 	error = sysc_init_syss_mask(ddata);
 	if (error)
-		goto unprepare;
+		return error;
 
 	error = sysc_init_pdata(ddata);
 	if (error)
-		goto unprepare;
+		return error;
 
 	sysc_init_early_quirks(ddata);
 
@@ -2414,7 +2414,7 @@  static int sysc_probe(struct platform_device *pdev)
 
 	error = sysc_init_resets(ddata);
 	if (error)
-		return error;
+		goto unprepare;
 
 	error = sysc_init_module(ddata);
 	if (error)