[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzRPdfC/2AdeMXtu@smile.fi.intel.com>
Date: Wed, 28 Sep 2022 16:43:17 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Thierry Reding <thierry.reding@...il.com>
Cc: linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Subject: Re: [PATCH v2 2/4] pwm: sysfs: Return directly from the for-loop in
PM callbacks
On Wed, Sep 28, 2022 at 02:31:23PM +0200, Thierry Reding wrote:
> On Fri, Aug 26, 2022 at 08:07:14PM +0300, Andy Shevchenko wrote:
> > There is no need to assign ret to 0 and then break the loop just
> > for returning the error to the caller. Instead, return directly
> > from the for-loop, and 0 otherwise.
> I fail to see how this is an improvement. The outcome is exactly the
> same and this doesn't even make the code shorter. Why bother?
The improvement is in maintenance. It's proven that assignments in the
definition block might lead to the subtle mistakes when it's not close
enough to the actual use. That said, this is an improvement from
maintaining and developing perspectives.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists