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=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 7C82FC433B4 for ; Wed, 7 Apr 2021 16:05:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54F876128D for ; Wed, 7 Apr 2021 16:05:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354113AbhDGQGD (ORCPT ); Wed, 7 Apr 2021 12:06:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:45364 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238641AbhDGQF6 (ORCPT ); Wed, 7 Apr 2021 12:05:58 -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 1F33FB1FD; Wed, 7 Apr 2021 16:05:47 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 8ABFD1F2B59; Wed, 7 Apr 2021 18:05:46 +0200 (CEST) Date: Wed, 7 Apr 2021 18:05:46 +0200 From: Jan Kara To: Julia Lawall Cc: Jan Kara , Amir Goldstein , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kbuild-all@lists.01.org, Denis Efremov Subject: Re: [PATCH] inotify: fix minmax.cocci warnings Message-ID: <20210407160546.GA3271@quack2.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 06-04-21 22:49:26, Julia Lawall wrote: > From: kernel test robot > > Opportunity for min(). > > Generated by: scripts/coccinelle/misc/minmax.cocci > > Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script") > CC: Denis Efremov > Reported-by: kernel test robot > Signed-off-by: kernel test robot > Signed-off-by: Julia Lawall ... > --- a/fs/notify/inotify/inotify_user.c > +++ b/fs/notify/inotify/inotify_user.c > @@ -382,7 +382,7 @@ static int inotify_add_to_idr(struct idr > > spin_unlock(idr_lock); > idr_preload_end(); > - return ret < 0 ? ret : 0; > + return min(ret, 0); > } Honestly, while previous expression is a standard idiom for "if 'ret' holds an error, return it", the new expression is harder to understand for me. So I prefer to keep things as they are in this particular case... Honza -- Jan Kara SUSE Labs, CR