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 B3A74C433F5 for ; Mon, 11 Apr 2022 15:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348084AbiDKPwI (ORCPT ); Mon, 11 Apr 2022 11:52:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348265AbiDKPwH (ORCPT ); Mon, 11 Apr 2022 11:52:07 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 324AEF21; Mon, 11 Apr 2022 08:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649692192; x=1681228192; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gyDoMc98GJmanTHsL9qK4pOeFXXJEueQFvdOn+5W79Q=; b=amlsel1Uy9yIbiytLhirB8tp8mpgRstrJ90lUEyqAAmyFZLMARkfR7Eu 5d5QDnl+FkGSTqL5dkKbm/vlvEtuInXaYiY4q/VuK+2zlWgfi3Ob3S9yR 2ndh6do8c/9ap3JUZ7FESw0kYbojapUR/2kEKiKAcBLXUcF3x3C9MOM/O grzHdNRIQShBOEWP5CZ6qv/NGEVCcr2SeRkIScHlJJs8/Nf1oM46Okvp0 nXe0sHDz244+uKrx1nYSlUeqGcJmgQVRlUU/EclKDOCjdVAV38ZKNtRlG qnehE2fXfGC8g0fBajnryQDuFb1riB1olRaSiHt0hJveFsd+MPzPjFRaI Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10314"; a="262326628" X-IronPort-AV: E=Sophos;i="5.90,252,1643702400"; d="scan'208";a="262326628" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2022 08:49:51 -0700 X-IronPort-AV: E=Sophos;i="5.90,252,1643702400"; d="scan'208";a="660096199" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2022 08:49:47 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1ndwEx-001J5c-Tx; Mon, 11 Apr 2022 18:46:07 +0300 Date: Mon, 11 Apr 2022 18:46:07 +0300 From: Andy Shevchenko To: Greg Kroah-Hartman Cc: Rob Herring , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Daniel Scally , Heikki Krogerus , Sakari Ailus , "Rafael J. Wysocki" , Rob Herring , Frank Rowand , Len Brown , Nuno =?iso-8859-1?Q?S=E1?= , Michael Walle Subject: Re: [PATCH v6 1/5] device property: Allow error pointer to be passed to fwnode APIs Message-ID: References: <20220408184844.22829-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 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Mon, Apr 11, 2022 at 04:28:06PM +0200, Greg Kroah-Hartman wrote: > On Mon, Apr 11, 2022 at 04:50:11PM +0300, Andy Shevchenko wrote: > > On Fri, Apr 08, 2022 at 09:48:40PM +0300, Andy Shevchenko wrote: > > > Some of the fwnode APIs might return an error pointer instead of NULL > > > or valid fwnode handle. The result of such API call may be considered > > > optional and hence the test for it is usually done in a form of > > > > > > fwnode = fwnode_find_reference(...); > > > if (IS_ERR(fwnode)) > > > ...error handling... > > > > > > Nevertheless the resulting fwnode may have bumped the reference count > > > and hence caller of the above API is obliged to call fwnode_handle_put(). > > > Since fwnode may be not valid either as NULL or error pointer the check > > > has to be performed there. This approach uglifies the code and adds > > > a point of making a mistake, i.e. forgetting about error point case. > > > > > > To prevent this, allow an error pointer to be passed to the fwnode APIs. > > > > Rafael and Greg, if this okay for you, can the first three patches be > > applied, so we will have at least the fix in and consider constification > > a further work? > > Give us a chance, you sent this on friday and are asking about it first > thing Monday morning? > > Please go and review other patches sent on the list to help us catch up. OK! Reviewed (actually commented on) a few patches so far. -- With Best Regards, Andy Shevchenko