Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp299056pxw; Fri, 8 Apr 2022 07:55:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEAUCYCPSqHlrPW9VLNLvX67LCW8JatG23pP+7C0nITu+bxWTi5ejrSXLrRj5gBcQsswu+ X-Received: by 2002:a05:6a00:1da1:b0:4fa:a53d:d0a5 with SMTP id z33-20020a056a001da100b004faa53dd0a5mr19943931pfw.42.1649429734328; Fri, 08 Apr 2022 07:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649429734; cv=none; d=google.com; s=arc-20160816; b=uSVOaXD6M89bqnkn1StvY3R16LQEZwT3mr9Jrfqop5B6nM5Di9n4ORkmwJ3Z3zI3dO WP+LYKGXbQdBZ3ggzqUcTmrEE0kb+3eOIPa6ht1W06VTYPCWaACbP7SZ65btMst13bIw voNjtnyLvUQ2v6W3hISt2CqQi64Z9wUUoM5OH/5wglkyDpUj4R2Ojl1G7OAm6vnES1cY 5xo1dKlhl8qesYxI+T0pGs+x1ygcLhuCO6x9u7JWzyI6FPlie3edJbAuk+FEAcHJyxrn QCd8zqBbbFi4zUwV7Hi+LFKIk7lPLwAhs6Nnw1ENlNEkQR3lC/h5VU7Yk0/viXyemgHW 22GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7WtW1y/anRFPDajXoutWHMxWsvSAL3FVGl3y3Q+ImrY=; b=nM0A2llUmiGcVqO9yXn+rwTI6j/0WsjblCHxNnq6mbHXB+kfd2ESCMD+B5rXX7WqOP 6gLGGUjqzzeuUUKJVV4QSMjCn5YxN8mx9ezRhMfLwn4N4QHdCRxhasO8S2c6CckyEawx C+1+lXnu5SMRLVlonnkjjk3J14CvZ9iPgOILX5LmH3o5smp5g79K6GLt8T9Hanu/SahY /VIPieznlDbyExHa3Utlft/8K+1zP0KsgkfYPB2uRv7HjI+r5B40ZNPmGuZkwhBMFSQh ba9VrHtbqjZoSC/M3rXBtzTJSpcPLWCDEXtcctdmVP7bX3dBmAjv/oTLnU3tTWeAZl2P 0KbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QYfpu9yS; 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 j63-20020a638042000000b0039d0f6c6a68si622209pgd.289.2022.04.08.07.55.17; Fri, 08 Apr 2022 07:55:34 -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=QYfpu9yS; 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 S236255AbiDHN3h (ORCPT + 99 others); Fri, 8 Apr 2022 09:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230135AbiDHN3f (ORCPT ); Fri, 8 Apr 2022 09:29:35 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A14BAE; Fri, 8 Apr 2022 06:27:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649424451; x=1680960451; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=/HA1QiQ6H5p+tsSS3FpYA6QqwmIqKeG4+bzRgPHZynE=; b=QYfpu9yS0XGLYL+fF8SKmi+aEsYeSSmYuC0cDcvSobmjJfxj2y2E6Dji ggiP8IbPXlwHjGXW9nAvMqCZSsn+WtTp/pg52y+aog/Y153dIJ12Tz4IE 1Qcgay6SF4dtyEaHXTTZsQsgn8LNw/sJYu0fMocHpSw9cOmLqPhQ1J5Pb X3g3UrF8XddXCNLju+ieI0nD1QJNyMarG722i/q7XLZxIXjoJlnPCiqH7 ZbUfRMpCdKj2+3HTEfTHvNPkvumMJJp7Q1aDWiFTadPbdh+tDBC3Qhx6s X07CCJuTvKO/3NLxMIfrCgGmHkUhMni1hDpy+WFYwwD5xXDBhOn4AXimb A==; X-IronPort-AV: E=McAfee;i="6400,9594,10310"; a="243724447" X-IronPort-AV: E=Sophos;i="5.90,245,1643702400"; d="scan'208";a="243724447" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2022 06:27:31 -0700 X-IronPort-AV: E=Sophos;i="5.90,245,1643702400"; d="scan'208";a="571487565" Received: from punajuuri.fi.intel.com (HELO paasikivi.fi.intel.com) ([10.237.72.43]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2022 06:27:28 -0700 Received: from paasikivi.fi.intel.com (localhost [127.0.0.1]) by paasikivi.fi.intel.com (Postfix) with SMTP id 8EE0E201C0; Fri, 8 Apr 2022 16:27:26 +0300 (EEST) Date: Fri, 8 Apr 2022 16:27:26 +0300 From: Sakari Ailus To: Andy Shevchenko 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: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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 Hi Andy, 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, but I'm not sure any caller would be interested in that. > > 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 > > -- Sakari Ailus