From patchwork Tue May 31 14:11:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12865740 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 6C430C433F5 for ; Tue, 31 May 2022 14:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345133AbiEaOLY (ORCPT ); Tue, 31 May 2022 10:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345005AbiEaOLX (ORCPT ); Tue, 31 May 2022 10:11:23 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7719265422; Tue, 31 May 2022 07:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654006282; x=1685542282; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K2Sm7KR4WlYANKzzxvSs11cMHFq39jJccsP/ycyK3bY=; b=oHemOSvPp4APn+z/NUfMWYfS4mreiS17DozPYsGCaryUHbXA5Am3NyD6 4LQs5MNu1ggXWFPmRPmA65GhfI+oz71UZySQeFKBnJv9WHxJ4IcecWUD9 MOyYzA4ZfKHw/61y1l/Fe1grNEVGkm3f2ddKHxzznG1yhAtsPEua+UMpM C5EWr64Q+f/b/26OuEDk9VnqxwMV8T7DT+jdYYOw/156wpl3RhqaE7+qe wwzHezQOSFvmoHKjrU/ScSDu6CFuMM1bURYfjZ6XdQ74giA6EdvlKI7L4 uyy8q4FPgsj4qr9+Iu3XEZ23rNJpk2zh0J0X/qscJnLIOA2qgarzjvefy g==; X-IronPort-AV: E=McAfee;i="6400,9594,10364"; a="272831554" X-IronPort-AV: E=Sophos;i="5.91,265,1647327600"; d="scan'208";a="272831554" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 07:11:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,265,1647327600"; d="scan'208";a="562335391" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 31 May 2022 07:11:20 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5C9E2165; Tue, 31 May 2022 17:11:22 +0300 (EEST) From: Andy Shevchenko To: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen , Michal Simek , Andy Shevchenko Subject: [PATCH v1 2/2] iio: adc: xilinx-xadc: Drop duplicate NULL check in xadc_parse_dt() Date: Tue, 31 May 2022 17:11:18 +0300 Message-Id: <20220531141118.64540-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531141118.64540-1-andriy.shevchenko@linux.intel.com> References: <20220531141118.64540-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org The fwnode_for_each_child_node() is NULL-aware, no need to check its parameters outside. Drop duplicate NULL check in xadc_parse_dt(). Signed-off-by: Andy Shevchenko --- drivers/iio/adc/xilinx-xadc-core.c | 38 ++++++++++++++---------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index e883f95f0cda..1b247722ba25 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c @@ -1247,30 +1247,28 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq) chan = &channels[9]; chan_node = device_get_named_child_node(dev, "xlnx,channels"); - if (chan_node) { - fwnode_for_each_child_node(chan_node, child) { - if (num_channels >= max_channels) { - fwnode_handle_put(child); - break; - } + fwnode_for_each_child_node(chan_node, child) { + if (num_channels >= max_channels) { + fwnode_handle_put(child); + break; + } - ret = fwnode_property_read_u32(child, "reg", ®); - if (ret || reg > 16) - continue; + ret = fwnode_property_read_u32(child, "reg", ®); + if (ret || reg > 16) + continue; - if (fwnode_property_read_bool(child, "xlnx,bipolar")) - chan->scan_type.sign = 's'; + if (fwnode_property_read_bool(child, "xlnx,bipolar")) + chan->scan_type.sign = 's'; - if (reg == 0) { - chan->scan_index = 11; - chan->address = XADC_REG_VPVN; - } else { - chan->scan_index = 15 + reg; - chan->address = XADC_REG_VAUX(reg - 1); - } - num_channels++; - chan++; + if (reg == 0) { + chan->scan_index = 11; + chan->address = XADC_REG_VPVN; + } else { + chan->scan_index = 15 + reg; + chan->address = XADC_REG_VAUX(reg - 1); } + num_channels++; + chan++; } fwnode_handle_put(chan_node);