mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ozgur Karatas <okaratas@member.fsf.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "dave@stgolabs.net" <dave@stgolabs.net>,
	"dvhart@linux.intel.com" <dvhart@linux.intel.com>,
	"bigeasy@linutronix.de" <bigeasy@linutronix.de>,
	"mgorman@suse.de" <mgorman@suse.de>,
	"dingel@linux.vnet.ibm.com" <dingel@linux.vnet.ibm.com>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/1] kernel: futex: fixed to else and initcall
Date: Tue, 20 Dec 2016 11:39:43 +0200	[thread overview]
Message-ID: <2535801482226783@web18g.yandex.ru> (raw)
In-Reply-To: <alpine.DEB.2.20.1612201006300.3436@nanos>

20.12.2016, 11:21, "Thomas Gleixner" <tglx@linutronix.de>:
> On Mon, 19 Dec 2016, Ozgur Karatas wrote:
>
>>  else doesn't need to be used, if should be enclosed in parentheses.
>
> Really?
>
>
> So you change the code from
>
>         if (err < 0)
>                 return err;
>             else
>                 err = 0;
>
> to
>
>         if (err < 0) {
>                 return err;
>                 err = 0;
>         }
>
> How on earth is that equivivalent and how would that 'err = 0;' statement
> be ever executed?

Oh my god, I missed this point, sorry! 
Thank you so much for correct me.

This "return err;" will give to "err" and err defined to err = "0".
Then removed to "else" and return = err;  and should it be like this?

#define err = 0;

         if (err < 0) {
                 return err;
         }

Regards,

Ozgur

> You clearly ran checkpatch.pl on this file and the output for this
> construct is:
>
> WARNING: else is not generally useful after a break or return
> #550: FILE: kernel/futex.c:550:
> + return err;
> + else
>
> So the proper change would have been:
>
>         if (err < 0)
>                 return err;
>
>         err = 0;
>
> and not the trainwreck you created.
>
> checkpatch.pl does not substitute basic knowlegde of C.
>
> Thanks,
>
>         tglx

  reply	other threads:[~2016-12-20  9:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 20:53 Ozgur Karatas
2016-12-20  9:18 ` Thomas Gleixner
2016-12-20  9:39   ` Ozgur Karatas [this message]
2016-12-20 10:36     ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2535801482226783@web18g.yandex.ru \
    --to=okaratas@member.fsf.org \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=dave@stgolabs.net \
    --cc=dingel@linux.vnet.ibm.com \
    --cc=dvhart@linux.intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®