lkml.org 
[lkml]   [2016]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] clocksource/drivers/tango-xtal: Fix incorrect test
On Tue, Apr 19, 2016 at 04:05:19PM +0200, Mason wrote:
> On 19/04/2016 15:13, Daniel Lezcano wrote:
>
> > On Tue, Apr 19, 2016 at 02:15:15PM +0200, Mason wrote:
> >
> >> From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
> >>
> >> Commit 0881841f7e78 changed "if (ret != 0)" to "if (!ret)"
> >>
> >> Fixes: 0881841f7e78 ("Replace code by clocksource_mmio_init")
> >> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
> >> ---
> >
> > Please resend the patch with the fix only, without s/ret/err/
>
> As I wrote on IRC, I think it is misguided to consider variable
> renaming as not part of the fix. A properly named variable helps
> reviewers by communicating intent.
>
> Had I named the variable 'err' in the first place, would you have
> introduced the bug by writing
>
> if (!err) {
> pr_err("registration failed");
> }
>
> or would if (!err) have jumped out for an error path?
> (Not a rhetorical question; if you say it would not have helped,
> then I guess my mental workflow is different.)

Ok I won't argue for a stupid variable name.

The point is we are at v4.6-rc4 and even if the change is obvious, it is a
good practice to do a simple change:

- if (!ret) {
+ if (ret) {

Why ? Because maintainers have a lot of code to review, and removing the
noise as much as possible helps them to make their life easier especially
when they have to pay double attention for fixes at RC.

If the 'ret' name is a problem for you, just send another patch for v4.7 to
change the name.

-- Daniel

\
 
 \ /
  Last update: 2016-04-19 17:21    [W:0.060 / U:5.932 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site