From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B84A7C433DF for ; Fri, 14 Aug 2020 10:03:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E2612074D for ; Fri, 14 Aug 2020 10:03:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbgHNKDc (ORCPT ); Fri, 14 Aug 2020 06:03:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:43442 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726012AbgHNKDc (ORCPT ); Fri, 14 Aug 2020 06:03:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3E244AD1B; Fri, 14 Aug 2020 10:03:53 +0000 (UTC) Received: from localhost (brahms.olymp [local]) by brahms.olymp (OpenSMTPD) with ESMTPA id fc9ad6f5; Fri, 14 Aug 2020 10:03:28 +0000 (UTC) From: Luis Henriques To: David Laight Cc: Jeff Layton , Ilya Dryomov , "ceph-devel@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] ceph: remove unnecessary return in switch statement References: <20200814093822.GA293898@suse.de> Date: Fri, 14 Aug 2020 11:03:28 +0100 In-Reply-To: (David Laight's message of "Fri, 14 Aug 2020 09:52:38 +0000") Message-ID: <877du1h7db.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Laight writes: > From: Luis Henriques >> Sent: 14 August 2020 10:38 >> >> Since there's a return immediately after the 'break', there's no need for >> this extra 'return' in the S_IFDIR case. >> >> Signed-off-by: Luis Henriques >> --- >> fs/ceph/file.c | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/fs/ceph/file.c b/fs/ceph/file.c >> index d51c3f2fdca0..04ab99c0223a 100644 >> --- a/fs/ceph/file.c >> +++ b/fs/ceph/file.c >> @@ -256,8 +256,6 @@ static int ceph_init_file(struct inode *inode, struct file *file, int fmode) >> case S_IFDIR: >> ret = ceph_init_file_info(inode, file, fmode, >> S_ISDIR(inode->i_mode)); >> - if (ret) >> - return ret; >> break; >> >> case S_IFLNK: > > I'd move the other way and just do: > return ceph_init_file_info(...); Sure, that would work too, although my preference would be to have a single function exit point. But I'll leave that decision to Jeff :-) Cheers, -- Luis > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) >