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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT 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 8378AC18E01 for ; Tue, 20 Nov 2018 13:26:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51999206BB for ; Tue, 20 Nov 2018 13:26:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51999206BB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbeKTXze (ORCPT ); Tue, 20 Nov 2018 18:55:34 -0500 Received: from mga14.intel.com ([192.55.52.115]:36829 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726911AbeKTXzd (ORCPT ); Tue, 20 Nov 2018 18:55:33 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Nov 2018 05:26:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,257,1539673200"; d="scan'208";a="87857687" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga008.fm.intel.com with ESMTP; 20 Nov 2018 05:26:21 -0800 Received: from andy by smile with local (Exim 4.91) (envelope-from ) id 1gP62l-0002PW-NL; Tue, 20 Nov 2018 15:26:19 +0200 Date: Tue, 20 Nov 2018 15:26:19 +0200 From: Andy Shevchenko To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Phil Edworthy , Stephen Boyd , Michael Turquette , Russell King , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Greg Ungerer , Geert Uytterhoeven , Ralf Baechle , Paul Burton , James Hogan , Jiaxun Yang , Huacai Chen , Guan Xuetao , linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] clk: Add (devm_)clk_get_optional() functions Message-ID: <20181120132619.GY10650@smile.fi.intel.com> References: <20181119141259.11992-1-phil.edworthy@renesas.com> <20181120103832.GV10650@smile.fi.intel.com> <20181120125652.afk2rltmnunfo346@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181120125652.afk2rltmnunfo346@pengutronix.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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 Tue, Nov 20, 2018 at 01:56:52PM +0100, Uwe Kleine-König wrote: > On Tue, Nov 20, 2018 at 12:38:33PM +0200, Andy Shevchenko wrote: > > On Mon, Nov 19, 2018 at 02:12:59PM +0000, Phil Edworthy wrote: > > > + if (clk == ERR_PTR(-ENOENT)) > > > + return NULL; > > > + else > > > + return clk; > > > > return clk == ERR_PTR(-ENOENT) ? NULL : clk; > > > > ? > > Not sure this adds to the readability of the expression. Personally I > prefer the explicit if. Maybe even: > > clk = clk_get(...); > > if (clk == ERR_PTR(-ENOENT)) > clk = NULL; > > return clk; So, it almost repeats the initial variant. I'm fine with no 'else' in initial code, like if (...) return NULL; return clk; -- With Best Regards, Andy Shevchenko