From patchwork Thu Sep 26 16:08:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13813501 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30B98CDE020 for ; Thu, 26 Sep 2024 16:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=gP+KVl3Nki9xP9jnHdY7npTezgVnfLdw1bgRUHESfM8=; b=Cc9L0aZCQ1Bx26 H1hoxZcc57cyQRH/+BR/4N/mF5myRvfbI4lOoRnqjOfMjzmOYCbntPt2JrQmAoE8TdWF+BQLA6tOG 1gWg0w3jphsm4CbnN2kEXlbGB7iCo7hpVloHZRHF9xROflQ9vmcFHhZ7zsUzUfK54PM2Br7QxUuOm JkO7qN54S8++TmgRfTGAYznGuWd/Z4pDvuLwBlD/MFJip1JC9ktjKlBbsIZh8qJKhkdsa87AkMiRA SbT0vZ1hnIl/Y+yGFcihUzObgjSQ2toeqfOHmkBRMFqPLsjgr0hUmstLen6zmIwErxgu+NFFHVBUy siaoSLZTZ7WIY0VHWsug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1str4I-00000008qj6-2aA5; Thu, 26 Sep 2024 16:10:14 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1str2o-00000008qLX-29wK for linux-arm-kernel@lists.infradead.org; Thu, 26 Sep 2024 16:08:43 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a8a789c4fc5so389449266b.0 for ; Thu, 26 Sep 2024 09:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727366920; x=1727971720; darn=lists.infradead.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=gP+KVl3Nki9xP9jnHdY7npTezgVnfLdw1bgRUHESfM8=; b=M6mJR09rSVaopp9Nilktd5KJzm0Zghzr6rvbn+zAxJfCpHgmhP7KINTISsgGZVCZdY SuNvLy+qxQBIQwY9ksci37F0zVn17QRDIyQ77NqPZRVOQnH2DbC1pszprir62oBI2OL5 J08KtqWLZmEnFfAbLBKDhrHSuaJHTXbTXRs/uUvlLVOmgHbZeZ0/J6X1iFhXWRmQB+YN 8bIe2owjyqEBYaP11lOoC3fuid7eGzYa+AKQtfgxwkmphqb/JAujzExPHEyDCmCbGfxR bvFKZcug+zW+SUjVccGPz0ktngXRnNuchBqR9Hm+qNdT0Vz4UjYtgK0mapxZMx3CMckO 7NEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727366920; x=1727971720; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gP+KVl3Nki9xP9jnHdY7npTezgVnfLdw1bgRUHESfM8=; b=xLcmNKDcU73W9qgd3OINi31nYGtEPGefiA6GXUdfj/gAp7X8sTvD0YRzhy4d/IAq9N yevd4EW1tk9Ly3s/5mBI5cNS0EqSOmhku5dQpQYvkCufIF2e3lZWhUAbeG0GMpbXZvjh 9Pko8TIVXFh2PFKF6YuO0gNpqjpB4PgLuJo9PUbzfFJdaQp1bF9GNAJMWq/M2A50jwR1 X7MVPuQRHsTeO9R7m7sUkYJqwx457FvJvamsXi4VBZ5aCYN/SDG+UYzwgbAwPcOUlUWU y3Z7a7W1v9vnbYlrsjPtDoI3yt/0sb8riyikh7fkAc1sR2y8/xdcT2pzCAUWbtXMKxfd 80DA== X-Forwarded-Encrypted: i=1; AJvYcCVHFYb8KB6xhry2kCUdlOSbWf0jpaPj2/Q+IeRZLEzbevbVJSAj0r0MVAZwmkNsnQDnyJ6dP4oIPXINeC2c4SwZ@lists.infradead.org X-Gm-Message-State: AOJu0YzSpJnSi97eOC9In4EUg+0DEJEvrPgeWsmIjREZmCysXOFn0WNT CrhpOY7MrfOJWvkAjkp04BAAPk+yQuaj8Z3+eS8u2Pu1WPh9H3+Y X-Google-Smtp-Source: AGHT+IHJD6ELGXqZ1LcvJSbwjs53CX/iyOKOge9JOfylo2K10ErpdDcSnwB/LYDMcLoXoMRgMBLADg== X-Received: by 2002:a17:907:36cd:b0:a7a:acae:340b with SMTP id a640c23a62f3a-a93c32119afmr42883666b.31.1727366919820; Thu, 26 Sep 2024 09:08:39 -0700 (PDT) Received: from [127.0.1.1] (2a02-8389-41cf-e200-6d88-4cd9-a9d4-f267.cable.dynamic.v6.surfer.at. [2a02:8389:41cf:e200:6d88:4cd9:a9d4:f267]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c27c70d3sm13947966b.78.2024.09.26.09.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2024 09:08:38 -0700 (PDT) From: Javier Carrasco Subject: [PATCH 0/4] iio: adc: use scoped device_for_each_childe_node() Date: Thu, 26 Sep 2024 18:08:36 +0200 Message-Id: <20240926-iio_device_for_each_child_node_scoped-v1-0-64ca8a424578@gmail.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAASH9WYC/x2NXQqDMBAGryL73ICNP2CvUsqiu1+ahZJIAqUg3 t3Qx4Fh5qCKYqj06A4q+Fq1nBrcbx1JXNMbzrQx+d6P/eJnZ5ZZmyjgkAtjlcgS7aOcsoKr5B3 qZJuGEXOYdNmotfaCYL//5/k6zwvp/FZhdwAAAA== To: Jonathan Cameron , Lars-Peter Clausen , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Michael Hennerich Cc: linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1727366918; l=1474; i=javier.carrasco.cruz@gmail.com; s=20240312; h=from:subject:message-id; bh=1CI/fpmiMGMi1J3jURicxvginVm5OIwiTVw57yhg7jw=; b=9sbPl0gcd83nFbHGowD5FIQz+dLJhH94gn6DMUgsGRmoscq/J8Acvc+dh92pABpm6VnlTSEw+ rKGP2hFhzmLAOHlJD6dEO29nVZ5b7zWDqDL/ztTqX/8J9DlWpX+pgIi X-Developer-Key: i=javier.carrasco.cruz@gmail.com; a=ed25519; pk=lzSIvIzMz0JhJrzLXI0HAdPwsNPSSmEn6RbS+PTS9aQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240926_090842_629980_E2C49A75 X-CRM114-Status: GOOD ( 10.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The device_for_each_child_node() macro requires calls to fwnode_handle_put() upon early exits (break/return), and that has been a constant source of bugs in the kernel. This series switches to the more secure, scoped version of the macro in the IIO subsystem, wherever the loop contains error paths. This change simplifies the code and removes the explicit calls to fwnode_handle_put(). In all cases the child node is only used for parsing, and not assigned to be used later. The straightforward uses of the loop with no error paths have been left untouched, as their simplicity justifies the non-scoped variant. Signed-off-by: Javier Carrasco --- Javier Carrasco (4): iio: adc: qcom-pm8xxx-xoadc: use scoped device_for_each_child_node() iio: adc: qcom-spmi-vadc: use scoped device_for_each_child_node() iio: adc: sun20i-gpadc: use scoped device_for_each_child_node() iio: adc: ad5755: use scoped device_for_each_child_node() drivers/iio/adc/qcom-pm8xxx-xoadc.c | 8 +++----- drivers/iio/adc/qcom-spmi-vadc.c | 7 ++----- drivers/iio/adc/sun20i-gpadc-iio.c | 7 ++----- drivers/iio/dac/ad5755.c | 11 +++-------- 4 files changed, 10 insertions(+), 23 deletions(-) --- base-commit: 92fc9636d1471b7f68bfee70c776f7f77e747b97 change-id: 20240926-iio_device_for_each_child_node_scoped-cb534e6f5d9b Best regards,