From patchwork Sun Feb 11 17:42:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 199494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2032996dyd; Sun, 11 Feb 2024 09:45:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxxJXh2d2fja4ZOZtlzjVwJ7m5cT4tVcTIzO7+QHIGX+8u8mycbxdfRauP37pry9CSr/ZX X-Received: by 2002:a05:6a00:450f:b0:6e0:548c:97e5 with SMTP id cw15-20020a056a00450f00b006e0548c97e5mr5967080pfb.2.1707673517421; Sun, 11 Feb 2024 09:45:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707673517; cv=pass; d=google.com; s=arc-20160816; b=u9NNsfczjJxGRFD8a6bB4XqwSgI2EyFuggmvdu/jMr6KpgPpGMdzu+R4e4OlrL5j1w gaY/ga6jS4A59MBUYUvB0fsX2vPNuEiFeGhYPHDcQaW4IolDDttkWXb6pICK+T3XTwZB 6wkOZj/NhjFSBfHzlGsk6tyeUm27l6fRH6TtzhFSPQGmC8Cs+rFCvxvueuelc+/NWyUU ve2ssqQW9gdF8vmiNX0XVZY4mHn7n/jprMYi1MHZoMIWOZTMbejOxYvgTfWe+xNC3DK4 Mi9RVkrO/YODisuR0mLheLmuxbwmv1n5U/sFPGPaVnIZxRkmDlWY3Mwc0gOJxuWozOEM 2YOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PG5RTZkgI90P7Ay2I5/CrgUMTQxy+sFcIpFu69YFgvw=; fh=0YIId2Tm981pPetfXHTaab/v1QEWCK/J0ACXYXQ5O6M=; b=Chz7AAYrBtzR8exsyRFUkRN85DwCEvQ59Dd6ip8z8QUdRiCgCUXrQts6g6twnnMute 5YYkrbcG8oujXIEu78e9fbwtT6fP2IMy8kI4HM14GwRPU8eXWqaWvX5ysTNOQ2kDOIqX 09nAA5HBvMm/S58M8yg3fLXVg41sC4DaxzNwgTbKnK6ykDyYMs6YvW6sbVh4aLr/YA/Z YEkc1JegXokzjANtGd62TN2pcKuQfTsFbAXI+a+GG5Q6/A8Fa9izdNN0dGnD6WXcb0QA jqJo29eKxlhsNEOFi8jSTrqMTLwgsVJI8/TyfPlxxClObfnKvxjQt60W4pS9ptKxTkX1 2HDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r0aMipmi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60892-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60892-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUqNIw/qovA7pSMBIy4Hx6aQcheGE/YM2rav7H4kPKnwFONh1yI1QlunlsYicmNGgqKjkrlbMaujWrwUAVB1W+604lCLA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i134-20020a636d8c000000b005dc498de158si5094556pgc.49.2024.02.11.09.45.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 09:45:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60892-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r0aMipmi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60892-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60892-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 31FE1283AD0 for ; Sun, 11 Feb 2024 17:45:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 506F15F552; Sun, 11 Feb 2024 17:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r0aMipmi" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99AD45F484; Sun, 11 Feb 2024 17:43:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707673418; cv=none; b=dXeS5u/Lb738PKQRNwWBa3Gdo0+V0ywfLf65XikKWcSFGpvMukgNIaUtJdRnibFLx/d632QKX8Nq9l3z0lcs4RGmAg+ml6C1ssLT7ZrPK+L36JjqqhvYw23xdVsXF7Nb0bMzKxfOyWKhjzZ31NO6Ft7kh7dWmsEk3jh0zKfA/kg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707673418; c=relaxed/simple; bh=+y95bK88fWChXwFe8dJiZk61N/FAhsRBrO4KSZJeTWs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nZxDug7nyiKIvoYUqPROAyd7GVB8LMI76PgAcP9HkLu9nP+IKDt1ZburtclPMtU4ITIMxi8Ht1VLsNjbmg97y+cUQ1kmiV6KpPH7/tnJZvQAKemk09qAigdn4lMLl+oQY05kPmmS+eUXoYXTw96HwnHdX6+bmeVsE9OI8B9DvPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r0aMipmi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCDEDC43399; Sun, 11 Feb 2024 17:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707673418; bh=+y95bK88fWChXwFe8dJiZk61N/FAhsRBrO4KSZJeTWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r0aMipmisV6duMkJCRpkqpdiPLxLixTLkM5cdohBgSPZ/vPLi8d6FZf3X6qPvMpAA fouKTUqKFfVdvPxi+r9AIQuHW1o3LgPtJvxK6/fbMqMe4SrEmy+IFrL5mYKSCUvAMs jm9iT2GreDxVejZblrC07OV+QihDMEFH3qz56ukAkFcgCyz29e/yKtVnXlx4nmsMEJ 3/uwd5hTaV5JCI/pt92fIzGjJeIv4otRNES5Gevdr5g2lyKfdmn2iHOjZmKpAhIZSw qIwsBzz6I4G7c2uOowuCkhv3fDNYK2nTWVkewZPEhu/GmnAoPfkTj0DJFLFhNNNQF+ lQU34WT1KbA+w== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Rob Herring , Frank Rowand , linux-kernel@vger.kernel.org, Julia Lawall Cc: Peter Zijlstra , Nicolas Palix , Sumera Priyadarsini , "Rafael J . Wysocki" , Len Brown , linux-acpi@vger.kernel.org, Andy Shevchenko , Greg Kroah-Hartman , =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron Subject: [PATCH 7/8] iio: adc: ad7292: Use for_each_available_child_of_node_scoped() Date: Sun, 11 Feb 2024 17:42:35 +0000 Message-ID: <20240211174237.182947-8-jic23@kernel.org> X-Mailer: git-send-email 2.43.1 In-Reply-To: <20240211174237.182947-1-jic23@kernel.org> References: <20240211174237.182947-1-jic23@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790625466072504074 X-GMAIL-MSGID: 1790625466072504074 From: Jonathan Cameron Avoids the need for manual cleanup of_node_put() in early exits from the loop. Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ad7292.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c index cccacec5db6d..a9354bd1ce54 100644 --- a/drivers/iio/adc/ad7292.c +++ b/drivers/iio/adc/ad7292.c @@ -260,7 +260,6 @@ static int ad7292_probe(struct spi_device *spi) { struct ad7292_state *st; struct iio_dev *indio_dev; - struct device_node *child; bool diff_channels = false; int ret; @@ -305,12 +304,10 @@ static int ad7292_probe(struct spi_device *spi) indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->info = &ad7292_info; - for_each_available_child_of_node(spi->dev.of_node, child) { + for_each_available_child_of_node_scoped(spi->dev.of_node, child) { diff_channels = of_property_read_bool(child, "diff-channels"); - if (diff_channels) { - of_node_put(child); + if (diff_channels) break; - } } if (diff_channels) {