Hi,
On 10/10/2024 17:06, Andy Shevchenko wrote:
On Fri, Oct 04, 2024 at 05:46:44PM +0300, Tomi Valkeinen wrote:
Add error handling for i2c reads/writes in various places.
...
+ ret = ub953_write(priv, UB953_REG_CLKOUT_CTRL1, clkout_ctrl1);
+ if (ret)
+ return ret;
+
+ return 0;
This is just a more verbose version of
return ub953_write(priv, UB953_REG_CLKOUT_CTRL1, clkout_ctrl1);
...
- ub953_write_clkout_regs(priv, &clkout_data);
-
- return 0;
+ return ub953_write_clkout_regs(priv, &clkout_data);
...and seems you use that pattern.
I use the pattern selectively =).
If the function has a bunch of
ret = foo()
if (ret)
return ret;
blocks, I want to keep the pattern and thus I don't use "return foo();"
as the last line.
Also, I think, I usually like to use "return foo();" only with small
functions, as the function call becomes less visible with that format.
Tomi