From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751849AbbIQQvx (ORCPT ); Thu, 17 Sep 2015 12:51:53 -0400 Received: from sender154-mail.zoho.com ([74.201.84.154]:29895 "EHLO sender154-mail.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751104AbbIQQvw (ORCPT ); Thu, 17 Sep 2015 12:51:52 -0400 Message-ID: <55FAEF8C.7020204@innercoder.com> Date: Thu, 17 Sep 2015 11:51:24 -0500 From: Jaime Arrocha User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: Anjali Menon , gregkh@linuxfoundation.org CC: oleg.drokin@intel.com, jinshan.xiong@intel.com, linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org Subject: Re: [PATCH] staging: lustre: lustre: lclient: Removed the else statement References: <1442506481-8754-1-git-send-email-cse.anjalimenon@gmail.com> In-Reply-To: <1442506481-8754-1-git-send-email-cse.anjalimenon@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/17/2015 11:14 AM, Anjali Menon wrote: > Removed the else statement along with some unwanted brackets > to fix the following coding style warning detected by > checkpatch. > > WARNING: else is not generally useful after a break or return > > Signed-off-by: Anjali Menon > --- > drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c > index ab6cb41..23092fc 100644 > --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c > +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c > @@ -836,7 +836,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, > *exceed = 1; > } > return result; > - } else { > + } > /* > * region is within kms and, hence, within real file > * size (A). We need to increase i_size to cover the > @@ -847,14 +847,12 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, > * which will always be >= the kms value here. > * b=11081 > */ > - if (cl_isize_read(inode) < kms) { > - cl_isize_write_nolock(inode, kms); > - CDEBUG(D_VFSTRACE, > - DFID" updating i_size %llu\n", > - PFID(lu_object_fid(&obj->co_lu)), > - (__u64)cl_isize_read(inode)); > - > - } > + if (cl_isize_read(inode) < kms) { > + cl_isize_write_nolock(inode, kms); > + CDEBUG(D_VFSTRACE, > + DFID" updating i_size %llu\n", > + PFID(lu_object_fid(&obj->co_lu)), > + (__u64)cl_isize_read(inode)); > } > } > ccc_object_size_unlock(obj); I think the "else" bracket is needed for when the statement "pos > kms" is not true, but it might work since there's only two choices tested. The checkpatch.pl error can bring notices like that, what's important is the context of the code. It might be there to increase readability since it is kind of an obvious situation. That's just my analysis. -JA