Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp1269369pxw; Sat, 9 Apr 2022 17:52:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9zLXBsTSUX6cWiijKHF7DFBKkJJ3/lEtyTQllklEQZcnmqJJ0f5w0Z1C76ECXkHX3oqxK X-Received: by 2002:a05:6402:51d2:b0:41c:e157:84f1 with SMTP id r18-20020a05640251d200b0041ce15784f1mr26848753edd.135.1649551976578; Sat, 09 Apr 2022 17:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649551976; cv=none; d=google.com; s=arc-20160816; b=KS7C+LtTEj/2guR81XCR0hlmFwOrBuvSe7TOmeDS9pUbJAvs81hxYVQdRm3p8JtjQR ZAQIqr0KW/HHI48LzEvoTtF+5Z6Q7atc1HBY4fqT84QQhezoG07qU8pft8nQlxLxdB+p giKSXZfwYYk3wqCOF9h3VrnkwEYSiHXnQVn+wEeJyO3yR6jOo1H3GrhsZjKneuIo6upq w593slDzvu1t8Gpkvyd+PS7M/agxravgyyZ6NHbwf94CmBZWP0eB17Y3gZjYR3xfxyjq 5D6+yBEuUZSjHSLs4UwNoWQ3pfNNEgzsffmbtHY6WllGRu4HO7wGR46LpM7r8QhrWR+V AJDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=20EDlUOlt5S/OBeNZIzoicacQAD8x0Ku8FtRlLEh/lQ=; b=ilCP+0Er/WejXCMzmEpgJgFYJi/iGHVLSZbCXEJt+dyQegEvqOPiEKVwiQLnYnA9YS rjdNci/XDk3mWlii5+AnFYjivSsFk5WYRAJ0xLYpKczP66B47QeaR/o9NBca+2Ac83jX tEf6TpKD8xp/RJsyKCDfNNzJ7AT776GKs867xlGZCNRPqJM4KZ+Nl7l0KSp3FDqaaeY0 PiX3kbF0YcWMFQbRK2JPplDWfpoHPOJVjw6AiEpsu5WKJdL2PORmU9IIXBkSe+FGrgyB Tg4Okj7PI11L3wrWpbitP8rSfvbjfhgCS5MpYZhIltL4Juj+ZykTiBkXqZP/7EPuYJk+ 3P0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MlKymDw9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i19-20020a05640242d300b00418c2b5bd95si4938443edc.119.2022.04.09.17.52.24; Sat, 09 Apr 2022 17:52:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MlKymDw9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237260AbiDHO7t (ORCPT + 99 others); Fri, 8 Apr 2022 10:59:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235049AbiDHO7r (ORCPT ); Fri, 8 Apr 2022 10:59:47 -0400 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2996F118636; Fri, 8 Apr 2022 07:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649429864; x=1680965864; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Lyl03mlhWs42htV83HjHYtMI2teOzFnAwIEADD5Axxk=; b=MlKymDw9njpg6sPabDymiAkiFVyz0DecoAQrSSdpRZH7+NjigpVfCXly UHAOwLtRvsKGsAoYfO1mwkg9lT7EV6i+BurUn9UYvIxPmpv4GTrsoksjF c2k6sMADR0JrGYga8KDCThbfyn3GS5WgVAkJ3k/bEpVdk2iG0IVIuUAKd bl3Uet5mkmJS8JloNN6EjE4lEs+vqAkYqFyv2hynLEovqoENU1BREAIoK awBwrMFUctbK49xYp+bv4/LjIz+ROxjdNljXFyd+1JwvwZyyHv7MU3Sys wdqcfFw9R82t0xwsQzKkLPbyTxTv0KF4P0volqA3FsacyBs8+QEVxIe1n g==; X-IronPort-AV: E=McAfee;i="6400,9594,10310"; a="322298671" X-IronPort-AV: E=Sophos;i="5.90,245,1643702400"; d="scan'208";a="322298671" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2022 07:57:43 -0700 X-IronPort-AV: E=Sophos;i="5.90,245,1643702400"; d="scan'208";a="659511333" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2022 07:57:41 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1ncpzr-000Kof-JN; Fri, 08 Apr 2022 17:53:59 +0300 Date: Fri, 8 Apr 2022 17:53:59 +0300 From: Andy Shevchenko To: Sakari Ailus Cc: Michael Walle , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Scally , Heikki Krogerus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Len Brown , Nuno =?iso-8859-1?Q?S=E1?= Subject: Re: [PATCH v5 1/4] device property: Allow error pointer to be passed to fwnode APIs Message-ID: References: <20220406130552.30930-1-andriy.shevchenko@linux.intel.com> 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 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 08, 2022 at 04:27:26PM +0300, Sakari Ailus wrote: > On Fri, Apr 08, 2022 at 03:44:03PM +0300, Andy Shevchenko wrote: > > On Thu, Apr 07, 2022 at 01:19:44PM +0300, Andy Shevchenko wrote: > > > On Wed, Apr 06, 2022 at 08:05:23PM +0200, Michael Walle wrote: ... > > > > > + if (IS_ERR_OR_NULL(fwnode)) > > > > > + return -ENOENT; > > > > > + > > > > > ret = fwnode_call_int_op(fwnode, get_reference_args, prop, nargs_prop, > > > > > nargs, index, args); > > > > > + if (ret == 0) > > > > > + return ret; > > > > > > > > > > - if (ret < 0 && !IS_ERR_OR_NULL(fwnode) && > > > > > - !IS_ERR_OR_NULL(fwnode->secondary)) > > > > > - ret = fwnode_call_int_op(fwnode->secondary, get_reference_args, > > > > > - prop, nargs_prop, nargs, index, args); > > > > > + if (IS_ERR_OR_NULL(fwnode->secondary)) > > > > > + return -ENOENT; > > > > > > > > Doesn't this mean you overwrite any return code != 0 with -ENOENT? > > > > Is this intended? > > > > > > Indeed, it would shadow the error code. > > > > I was thinking more on this and am not sure about the best approach here. > > On one hand in the original code this returns the actual error code from > > the call against primary fwnode. But it can be at least -ENOENT or -EINVAL. > > > > But when we check the secondary fwnode we want to have understanding that it's > > secondary fwnode which has not been found, but this requires to have a good > > distinguishing between error codes from the callback. > > > > That said, the error codes convention of ->get_reference_args() simply > > sucks. Sakari, do you have it on your TODO to fix this mess out, if it's > > even feasible? > > What would you expect to see compared to what it is now? > > I guess the error code could be different for a missing property and a > property with invalid data, Yes, something like this. > but I'm not sure any caller would be interested > in that. Yes, but it would be good for the consistency and working with fwnodes in general. Esp. if we move at some point from primary-secondary to a full linked list of fwnodes. > > To be on safest side, I will change as suggested in previous mail (see below) > > so it won't have impact on -EINVAL case. > > > > > So, it should go with > > > > > > if (IS_ERR_OR_NULL(fwnode->secondary)) > > > return ret; > > > > > > then. -- With Best Regards, Andy Shevchenko