Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934208AbcLTJjs (ORCPT ); Tue, 20 Dec 2016 04:39:48 -0500 Received: from forward1h.cmail.yandex.net ([87.250.230.16]:59533 "EHLO forward1h.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933498AbcLTJjq (ORCPT ); Tue, 20 Dec 2016 04:39:46 -0500 Authentication-Results: mxback5g.mail.yandex.net; dkim=pass header.i=@yandex.com.tr From: Ozgur Karatas Envelope-From: mueddib@yandex.com.tr To: Thomas Gleixner Cc: "dave@stgolabs.net" , "dvhart@linux.intel.com" , "bigeasy@linutronix.de" , "mgorman@suse.de" , "dingel@linux.vnet.ibm.com" , "kirill.shutemov@linux.intel.com" , linux-kernel , Linus Torvalds , "akpm@linux-foundation.org" In-Reply-To: References: <263091482180789@web35j.yandex.ru> Subject: Re: [PATCH 1/1] kernel: futex: fixed to else and initcall MIME-Version: 1.0 Message-Id: <2535801482226783@web18g.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 20 Dec 2016 11:39:43 +0200 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1470 Lines: 63 20.12.2016, 11:21, "Thomas Gleixner" : > 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