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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22BBBC38A2D for ; Wed, 26 Oct 2022 05:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231847AbiJZF23 (ORCPT ); Wed, 26 Oct 2022 01:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230345AbiJZF21 (ORCPT ); Wed, 26 Oct 2022 01:28:27 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C04B88D0E3 for ; Tue, 25 Oct 2022 22:28:26 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5168D1FA95; Wed, 26 Oct 2022 05:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1666762105; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+7AfhfBH1W/lDI87QrEInzFsz78KYHY+XmnT7RfHHwc=; b=pxGz0nmBf24gIGVkb1+CAFcQw5DRiN2MDkZt7Vs56Nfdu53ValiIsrx3vtrwX/WPNsUEwl M4suuvFHIFiioMwKVUt60kpHd9gkGO26phIUM/IPezouHhpcelThV5aGG68BpLOTOKL7UN nNmnBlsdXh0LXUCM42jgmiTBAMpyR2A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1666762105; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+7AfhfBH1W/lDI87QrEInzFsz78KYHY+XmnT7RfHHwc=; b=/lseX0IScTek2Fcw5dpMmtZK4ZvBpO5kkrvCBXCT4l9mDDgwyv1ZKt8bmAgdDeiMvKXImc gmrbZNGUiewIIcCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1147613A3B; Wed, 26 Oct 2022 05:28:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id TXViA3nFWGNGZgAAMHmgww (envelope-from ); Wed, 26 Oct 2022 05:28:25 +0000 Date: Wed, 26 Oct 2022 07:28:26 +0200 Message-ID: <87pmefp30l.wl-tiwai@suse.de> From: Takashi Iwai To: Mark Brown Cc: wangkailong@jari.cn, perex@perex.cz, tiwai@suse.com, lgirdwood@gmail.com, motolav@gmail.com, cezary.rojewski@intel.com, mkumard@nvidia.com, pierre-louis.bossart@linux.intel.com, kai.vehmanen@linux.intel.com, peter.ujfalusi@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA/ASoC: replace ternary operator with min() In-Reply-To: References: <3d74bcaf.5.1840fa4d439.Coremail.wangkailong@jari.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 Oct 2022 19:01:32 +0200, Mark Brown wrote: > > On Tue, Oct 25, 2022 at 10:56:11PM +0800, wangkailong@jari.cn wrote: > > Fix the following coccicheck warning: > > > > sound/soc/soc-ops.c:817: WARNING opportunity for min() > > > kfree(uctl); > > - return err < 0 ? err : 0; > > + return min(err, 0); > > I don't think this is a good warning, while I'm no big fan of the > ternery operator the new code is less clear about the intent than the > old code. Agreed. That use of ternery is a standard idiom. If we have to eliminate the use of ternery inevitably, it'd be better to introduce a new macro for clarity instead. thanks, Takashi