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 DD391C04A95 for ; Tue, 25 Oct 2022 11:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231758AbiJYLP5 (ORCPT ); Tue, 25 Oct 2022 07:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231819AbiJYLPm (ORCPT ); Tue, 25 Oct 2022 07:15:42 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7050211E461; Tue, 25 Oct 2022 04:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666696541; x=1698232541; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=I/5u94u6MpEzVP8gikfALeB7J/YtsYkWMNaw/bQchGY=; b=fcrXhQPlhrvYU1vQRG+hXusiPCZKALwy93mnCFWVj6rHvkkBYfeifkb1 +TXyyd8RJII7RMc0RoYxnVZPBcRxvTcchBo6JnV58iB6Fdf5eEIRKpVmM MvCfV16Zoqi0AvnEFB4VXDTVCCllgaLTVlNUR8k8gxpBLZyZqNBIzC9ta iikHIdb1QaQsmUAMC3tyAuQ9wzptkN6S8J134ENtukgYC85vz1FaSyezT 1o7/BHel1GnJd0T4cVu7HoxOt4p7hB6YsGj3IlJgjkXkQuJ6SKzN1xLcF p5LA2f11yniOLeLj6escoB3/tZ6ous/hMFJQ2MUxXVg0KujvaRDe+Hi+y Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="306378060" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="306378060" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 04:15:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="960778489" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="960778489" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga005.fm.intel.com with ESMTP; 25 Oct 2022 04:15:38 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1onHuC-001xlF-1b; Tue, 25 Oct 2022 14:15:36 +0300 Date: Tue, 25 Oct 2022 14:15:36 +0300 From: Andy Shevchenko To: "Vaittinen, Matti" Cc: Matti Vaittinen , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Wolfram Sang , Akhil R , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-i2c@vger.kernel.org" Subject: Re: [PATCH 1/2] drivers: fwnode: fix fwnode_irq_get_byname() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 25, 2022 at 10:00:07AM +0000, Vaittinen, Matti wrote: > On 10/25/22 12:18, Andy Shevchenko wrote: > > On Tue, Oct 25, 2022 at 11:50:59AM +0300, Matti Vaittinen wrote: ... > >> + ret = fwnode_irq_get(fwnode, index); > > > >> + > > > > Redundant blank line and better to use traditional pattern: > > >> + if (!ret) > >> + return -EINVAL; > >> + > >> + return ret; > > > > if (ret) > > return ret; > > > > /* We treat mapping errors as invalid case */ > > return -EINVAL; > > > >> } > > I like the added comment - but in this case I don't prefer the > "traditional pattern" you suggest. We do check for a very special error > case indicated by ret 0. > > if (!ret) > return -EINVAL; > > makes it obvious the zero is special error. I don't think so. It makes ! easily to went through the cracks. If you want an explicit, use ' == 0' and add a comment. > if (ret) > return ret; > > the traditional pattern makes this look like traditional error return - > which it is not. The comment you added is nice though. It could be just > before the check for > > if (!ret). -- With Best Regards, Andy Shevchenko