public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel: acctc.c: Fixed else if not generally userful after a break or return warning.
@ 2014-09-25  3:13 Elshad Mustafayev
  2014-09-25  3:22 ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: Elshad Mustafayev @ 2014-09-25  3:13 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel

Fixed a coding style issue.

Signed-off-by: Elshad Mustafayev <elshadimo@gmail.com>
---
 kernel/acct.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/acct.c b/kernel/acct.c
index b4c667d..ed4cf00 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -376,9 +376,8 @@ static comp2_t encode_comp2_t(u64 value)
 	if (exp > MAXEXP2) {
 		/* Overflow. Return largest representable number instead. */
 		return (1ul << (MANTSIZE2+EXPSIZE2-1)) - 1;
-	} else {
-		return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1));
 	}
+	return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1));
 }
 #endif
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kernel: acctc.c: Fixed else if not generally userful after a break or return warning.
  2014-09-25  3:13 [PATCH] kernel: acctc.c: Fixed else if not generally userful after a break or return warning Elshad Mustafayev
@ 2014-09-25  3:22 ` Al Viro
  0 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2014-09-25  3:22 UTC (permalink / raw)
  To: Elshad Mustafayev; +Cc: linux-kernel

On Wed, Sep 24, 2014 at 11:13:45PM -0400, Elshad Mustafayev wrote:
> Fixed a coding style issue.
> 
> Signed-off-by: Elshad Mustafayev <elshadimo@gmail.com>
> ---
>  kernel/acct.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/kernel/acct.c b/kernel/acct.c
> index b4c667d..ed4cf00 100644
> --- a/kernel/acct.c
> +++ b/kernel/acct.c
> @@ -376,9 +376,8 @@ static comp2_t encode_comp2_t(u64 value)
>  	if (exp > MAXEXP2) {
>  		/* Overflow. Return largest representable number instead. */
>  		return (1ul << (MANTSIZE2+EXPSIZE2-1)) - 1;
> -	} else {
> -		return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1));
>  	}
> +	return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1));

Just what makes the replacement easier to follow?
	if (foo)
		return bar;
	else
		return baz;
is no less idiomatic than
	if (foo)
		return bar;
	return baz;

Al, really annoyed by how the words "coding style issue" are getting used as
a magic incantation...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kernel: acctc.c: Fixed else if not generally userful after a break or return warning
       [not found] <E1XX0bN-00032o-0x@feisty.vs19.net>
@ 2014-09-25  4:31 ` Joe Perches
       [not found]   ` <CAAm9=9QeO_VtdY+fJ5JbrBhN52z=JUeU09Nh3Mp04QWf+Qyygw@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-09-25  4:31 UTC (permalink / raw)
  To: Al Viro; +Cc: Elshad Mustafayev, LKML

On Wed, Sep 24, 2014 at 11:13:45PM -0400, Elshad Mustafayev wrote:
> > Fixed a coding style issue.
[]
> > diff --git a/kernel/acct.c b/kernel/acct.c
[]
> > @@ -376,9 +376,8 @@ static comp2_t encode_comp2_t(u64 value)
> >  	if (exp > MAXEXP2) {
> >  		/* Overflow. Return largest representable number instead. */
> >  		return (1ul << (MANTSIZE2+EXPSIZE2-1)) - 1;
> > -	} else {
> > -		return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1));
> >  	}
> > +	return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1));
> 
> Just what makes the replacement easier to follow?
> 	if (foo)
> 		return bar;
> 	else
> 		return baz;
> is no less idiomatic than
> 	if (foo)
> 		return bar;
> 	return baz;
> 
> Al, really annoyed by how the words "coding style issue" are getting used as
> a magic incantation...

I agree.

I'll see about updating checkpatch to avoid warning on

	if (foo)
		return bar;
	else
		return baz;



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kernel: acctc.c: Fixed else if not generally userful after a break or return warning
       [not found]   ` <CAAm9=9QeO_VtdY+fJ5JbrBhN52z=JUeU09Nh3Mp04QWf+Qyygw@mail.gmail.com>
@ 2014-09-25  5:00     ` Al Viro
  2014-09-25  5:05       ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2014-09-25  5:00 UTC (permalink / raw)
  To: Elshad Mustafayev; +Cc: Joe Perches, linux-kernel

On Thu, Sep 25, 2014 at 12:34:11AM -0400, Elshad Mustafayev wrote:
> I am sorry if I disturbed you. I just follow the steps in kernel newbies to
> get me in kernel development.

It's not you, it's checkpatch.pl plus the fairly common tendency to give
that thing a lot more respect than it deserves...

Basically, it's OK as a tool that draws ones attention to a subset of
code that might or might not be worth looking at; it gives both false
positives and false negatives and as long as there's not too much of those,
it's useful.  Provided that it does *not* replace one's taste.  I.e. "hey,
it points to these lines; let's take a look, some of those might be
worth some attention", rather than "The Most Holy Oracle Has Spoken;
Do What It Says".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kernel: acctc.c: Fixed else if not generally userful after a break or return warning
  2014-09-25  5:00     ` Al Viro
@ 2014-09-25  5:05       ` Joe Perches
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2014-09-25  5:05 UTC (permalink / raw)
  To: Al Viro; +Cc: Elshad Mustafayev, linux-kernel

On Thu, 2014-09-25 at 06:00 +0100, Al Viro wrote:
> It's not you, it's checkpatch.pl plus the fairly common tendency to give
> that thing a lot more respect than it deserves...
> 
> Basically, it's OK as a tool that draws ones attention to a subset of
> code that might or might not be worth looking at; it gives both false
> positives and false negatives and as long as there's not too much of those,
> it's useful.  Provided that it does *not* replace one's taste.  I.e. "hey,
> it points to these lines; let's take a look, some of those might be
> worth some attention", rather than "The Most Holy Oracle Has Spoken;
> Do What It Says".

Just so.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-09-25  5:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25  3:13 [PATCH] kernel: acctc.c: Fixed else if not generally userful after a break or return warning Elshad Mustafayev
2014-09-25  3:22 ` Al Viro
     [not found] <E1XX0bN-00032o-0x@feisty.vs19.net>
2014-09-25  4:31 ` Joe Perches
     [not found]   ` <CAAm9=9QeO_VtdY+fJ5JbrBhN52z=JUeU09Nh3Mp04QWf+Qyygw@mail.gmail.com>
2014-09-25  5:00     ` Al Viro
2014-09-25  5:05       ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox