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 62F95C433F5 for ; Thu, 3 Mar 2022 14:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234049AbiCCO2s (ORCPT ); Thu, 3 Mar 2022 09:28:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233156AbiCCO2p (ORCPT ); Thu, 3 Mar 2022 09:28:45 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D60511AA3E; Thu, 3 Mar 2022 06:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646317680; x=1677853680; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=Jab+XPv+RVt9cIn/M4Nqco0XXg3KqYSCJ4FwFNxeIRc=; b=E5WFaJBaWtygDxrPMuoJrhhjPr5sNhPhDGry6D4ZUOY0+jNiiaS2QFCs RAMNrvi2MDyF7We6HJplZhjTaS9Q92r0o0QlTTxEALi+M4hNDb4MAEzjF 97cF9p2w5fHWj09bLpksqBB91vDQOw4sw4f9kt7cGbpDjzvQxrnCouA1+ t8YU7PPHa2tt9j1HpexjKpNOpsBs19q3sYVa28aU6fbggNXSA+0OXMd6Y Q215WAlZ1n4xTb/7YmagJvaBLmDq/LHJT18IV3uMGqkVTEbcGELl0UzU7 jnj9GYOFmUSe7B7pEUeaeFCtrmwMMzy8ZxlT/A+OCdkNVU5mFcYMKCzai w==; X-IronPort-AV: E=McAfee;i="6200,9189,10274"; a="278369669" X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="278369669" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2022 06:27:59 -0800 X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="508609552" Received: from smile.fi.intel.com ([10.237.72.59]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2022 06:27:57 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nPmQA-00ApZA-MD; Thu, 03 Mar 2022 16:27:10 +0200 Date: Thu, 3 Mar 2022 16:27:10 +0200 From: Andy Shevchenko To: "Sa, Nuno" Cc: "linux-iio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Jonathan Cameron , Lars-Peter Clausen Subject: Re: [PATCH v3 3/3] iio: temperature: ltc2983: Make use of device properties Message-ID: References: <20220210135522.26562-1-andriy.shevchenko@linux.intel.com> <20220210135522.26562-3-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 Thu, Mar 03, 2022 at 04:23:34PM +0200, Andy Shevchenko wrote: > On Thu, Mar 03, 2022 at 01:31:56PM +0000, Sa, Nuno wrote: > > ... > > > > + ref = fwnode_find_reference(child, "adi,cold-junction- > > > handle", 0); > > > + if (ref) { > > > > This is nok. It needs to be 'if (IS_ERR(ref))'. We then should return > > ERR_CAST() in case of errors inside the if block. > > This is a good catch! > > > As this reference > > is also optional, we need to nullify ref in case we don't find the > > it. Otherwise fwnode_handle_put() breaks. > > No, this is not correct. fwnode_handle_put() is ERR_PTR aware. Oh, the ->put() handles that, but the fwnode_call_void_op() doesn't! This has to be fixed on fwnode level. > > We also need to use ptr error logic in the other places where > > fwnode_find_reference() is used. Although, in the other cases > > the ref is mandatory, so there's no need to care with breaking > > fwnode_handle_put(). > > > > After these changes (I think the changes are straight enough; > > but I can re-test if you or Jonathan ask for it): > > > > Tested-by: Nuno Sá -- With Best Regards, Andy Shevchenko