Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2721061ybz; Mon, 27 Apr 2020 03:19:11 -0700 (PDT) X-Google-Smtp-Source: APiQypLI0GuSxozn0DZ6DbhM7MEU7gW1LVoF0dlEi9wBMpEzC8GTZyS0VAhOt9L3lJ2nXmUlG0Fb X-Received: by 2002:a50:d0d5:: with SMTP id g21mr18484002edf.92.1587982751363; Mon, 27 Apr 2020 03:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587982751; cv=none; d=google.com; s=arc-20160816; b=lT3OW75wlUIWUv5/KL+1t/5bD00oDG8CH51CGXyalAuI77syw+38sawluTAIgZjnCv NUIPDKTqgbbG3JEu+Ujl7hpg+CkIkiejdMMzdr/1+Fjm1KX8Srqn5W0RXUrqVnOiY+0t HQE3+hu5gHltejF+NMb7yEPO15afabw4ckEFhLyOfUzkob3oX8/4tb8kx88SrCSMoevI kKijXVmUCZAqee3+vof2C193bt3soyWuCVkctLEI9iu3zqqQ3VKh+SlGfP0vFeqTJryl RBQCTF1XVRj+pk8JjcEUHEnmkA4LbOHhfhNl/Qeo9GRxqKIHtN8xufwSn/7jLtfVf7Oh uqxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=K17+JE2wueB7QBhH/nDcr8hYITmFEZ5MoUWXamUre2w=; b=XDRyvPY2MtVawIdUUyZebAzfRxU0kWDZmfIIU2sR01ylZXCvMzREO93CyFKznYppwG Z1FMkss+sgHNbXJSLP9QEX9XxK5RxgHCC2tZXY6gxVNf+cl8UxfwjzFRvY/JEEctgfAg +7LUTScimBJBLgioSpe6TRKqBsPpBNzSYcBfFpiau6Ir5ZSkDT8Z2enW4PIyH0ZFRFSV YbFvKYW9xQj6KhhKguG97xnxk1RbtSpY8qe5KimTCGBRkrL1swnF+rwdqz/m6DIG54xA 3qjk0nUVU3so0mS4TKGt1KbD0iLer092TxrSERl4NkU5reecghMt/k4EcC8FVcg1tSeG G+Yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si8321899ejd.3.2020.04.27.03.18.47; Mon, 27 Apr 2020 03:19:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726795AbgD0KPY (ORCPT + 99 others); Mon, 27 Apr 2020 06:15:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:58650 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726485AbgD0KPY (ORCPT ); Mon, 27 Apr 2020 06:15:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AF0FBAF0C; Mon, 27 Apr 2020 10:15:21 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 105041E129C; Mon, 27 Apr 2020 12:15:22 +0200 (CEST) Date: Mon, 27 Apr 2020 12:15:22 +0200 From: Jan Kara To: youngjun Cc: Jan Kara , Amir Goldstein , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] inotify: Fix error return code assignment flow. Message-ID: <20200427101522.GD15107@quack2.suse.cz> References: <20200426143316.29877-1-her0gyugyu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200426143316.29877-1-her0gyugyu@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun 26-04-20 07:33:16, youngjun wrote: > If error code is initialized -EINVAL, there is no need to assign -EINVAL. > > Signed-off-by: youngjun Thanks. I've added the cleanup to my tree, Honza > --- > fs/notify/inotify/inotify_user.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c > index 81ffc8629fc4..f88bbcc9efeb 100644 > --- a/fs/notify/inotify/inotify_user.c > +++ b/fs/notify/inotify/inotify_user.c > @@ -764,20 +764,18 @@ SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd) > struct fsnotify_group *group; > struct inotify_inode_mark *i_mark; > struct fd f; > - int ret = 0; > + int ret = -EINVAL; > > f = fdget(fd); > if (unlikely(!f.file)) > return -EBADF; > > /* verify that this is indeed an inotify instance */ > - ret = -EINVAL; > if (unlikely(f.file->f_op != &inotify_fops)) > goto out; > > group = f.file->private_data; > > - ret = -EINVAL; > i_mark = inotify_idr_find(group, wd); > if (unlikely(!i_mark)) > goto out; > -- > 2.17.1 > -- Jan Kara SUSE Labs, CR