mbox series

[v2,0/2] Qcom Geni exit path cleanups

Message ID 20241212135416.244504-1-andi.shyti@kernel.org
Headers show
Series Qcom Geni exit path cleanups | expand

Message

Andi Shyti Dec. 12, 2024, 1:54 p.m. UTC
Hi,

I am submitting two trivial cleanups in this series. The first
replaces all instances of dev_err with dev_err_probe throughout
the probe function for consistency. The second improves the error
exit path by introducing a single 'goto' label for better
maintainability.

Thank you Mukesh for your reviews.

Thank you,
Andi

Changelog:
==========
v1 -> v2:
 - Updated the final return statement to return 'ret' instead of
   '0' for consistency. Since 'ret' already holds the value '0',
   this change is purely aesthetic.
 - Renamed the exit label from 'err_off' to 'err_resources' for
   improved clarity and alignment with its purpose.

Andi Shyti (2):
  i2c: qcom-geni: Use dev_err_probe in the probe function
  i2c: qcom-geni: Simplify error handling in probe function

 drivers/i2c/busses/i2c-qcom-geni.c | 55 ++++++++++++++----------------
 1 file changed, 26 insertions(+), 29 deletions(-)

Comments

Andi Shyti Dec. 13, 2024, 12:57 a.m. UTC | #1
> >   	proto = geni_se_read_proto(&gi2c->se);
> >   	if (proto != GENI_SE_I2C) {
> > -		geni_se_resources_off(&gi2c->se);
> > -		clk_disable_unprepare(gi2c->core_clk);
> > -		return dev_err_probe(dev, -ENXIO, "Invalid proto %d\n", proto);
> > +		dev_err_probe(dev, -ENXIO, "Invalid proto %d\n", proto);
> > +		goto err_resources;
> 
> What's about setting ret = -ENXIO before bailing out?

Oh yes, sorry, my bad... I snap changed this patch without
using my brain. It was better in v1 :-)

Thanks Vladimir,
Andi