From patchwork Fri Aug 16 15:14:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13766590 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 AFEE1C531DC for ; Fri, 16 Aug 2024 16:16:35 +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:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=fKhgYZGd6MhEpwJKETkIMp2KfUsUFptLQmP8VXkZ9Mw=; b=Ih/kignhsaYrnGkhcUuwTIPqme WCTncLqdiD2IMcRI5erhmEu5gVyiySb97fMhbUAnN/bMx3wDQ9Edk8Yp5+AaWRtoiMrAPJbOUQ2GQ 9/hTv0Gg9PNE7vYEgGU/p8tn5/FrwfLSVaenpG9JuKqmtrs8igfeYk3sBfVpdUUKSLpktYlroMEpZ zA2B7sIlqcGVHzDgdpOzH1aEaWh0/U7gGUUIe80WQ6YnPMaep7vNGVJJQY6UsAK7H1At1qSPRbIcn PRF9otlwtmDUvLbRNTjNZLQB2fayNoEZIvefNyvwzv2C69yiBFfTKQfEQAlgIj0mT9WGrbrft3kuS cUAJJgKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sezce-0000000DXcE-46Gf; Fri, 16 Aug 2024 16:16:16 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyeh-0000000DLF0-14yb for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Aug 2024 15:14:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=fKhgYZGd6MhEpwJKETkIMp2KfUsUFptLQmP8VXkZ9Mw=; b=mRRN6/VFaKFn4k6vzLK4lc+nD5 01qoMODxgvMARI0TuH3jwwYUBHi+fXulZ4bmW3CJqYha4e18tIE+ycEGcfn0U0+6F8k8hbOwwZVzb S4uX7TsNX83HwSnfRXM5VbTvgPD3lf95WTnbItVX3whnwrAcoLi/52nkgFCeK50bsD/7dGg1bjV+S vxeWSRFlaOC+f3fDHDpkvqYg1mVczg3vXMvoKFXBs6y5ngWlLYLusrfmTdnIj+92emORIw3IgGXxS ITi0vlnwjO8m9po5BBR+az1zpzojhwfNtguIuQKZUV57n0HBOqeCZM0UpzyK36u54/CjcN1RQMmXp wQJ7oTvQ==; Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyeb-00000008h6I-3gwt for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:14:17 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3719896b7c8so291945f8f.3 for ; Fri, 16 Aug 2024 08:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723821250; x=1724426050; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fKhgYZGd6MhEpwJKETkIMp2KfUsUFptLQmP8VXkZ9Mw=; b=SfM7iScLsq8V8wZnVR8DBpkv2wsd+rKJSEgRjfTUNIYk09gRm2gfT9qNihdDZ4UuFG TNJpMrHpUX+CiDvB02mPccVNt4MPljvK55M+slt7Hgh0koCMjJUR5wuZBlIRx5oR4I0H s2vU8MR4YZ2fnPXMGN+vLyJvZvdE4cR7Gf28wB/qjrDKMySP5meTTviqvkmlLJvHbNdf Lwvhzz+f5zPkZrevV7wR+khaNPS1Rsr2NccTg9hMh61F3GyOnpSms5OikSOiTM5YIKSO khqs1fyDg4s1pmVPberYBFw0xmAWNG5hg9AahtJCJBzkdkReV1+ZLAGn+RhDYbSN3ciT NKUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723821250; x=1724426050; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fKhgYZGd6MhEpwJKETkIMp2KfUsUFptLQmP8VXkZ9Mw=; b=sX4EKHO56jG34gUMvbZ6k0k6EVwW1G86vFnfXvMjKY8hngOfSLJbBbmZYKx0nkt5cH 5gUrGPBdZL6DrDr0IJ4RdpDl3esPwk49RnIWNYDK09pt9kujvDeuCudmuw77fBAd1jCH cvCx0B5Wn8m87hRuBgwdf+11rm5DdJYF8a5Kgq9r/rsIE4fFQ4wwA+Ok7oPZ3YzqtMb8 qF0H3YSfmJjLddv7pG90r2YOXXoSpwL+6BOH68jHiB2uNI1Ax4PcWFKYXNIE36Mr+X+N kuZ+6oUwNB5mAP/lqL4fyQqDRxhIqtv7ome3hA+YXXEuoWE2BLmLNB4mRDDP44hBfmq8 3sXQ== X-Forwarded-Encrypted: i=1; AJvYcCVuQPd65kg1iM6Lp7ltvaQhhZlBu268Ms6pmlDnSPw/H9kzRP8IBb7kmKfKmNeQrAqbVG+ZYXUdqot4ntgvjNQpDbGPu3RTEGqKTirS+a+FrcSkf1s= X-Gm-Message-State: AOJu0YxbT3BmXvPldAx5rkt4iao2P5MfaO7wJ7tS4FjwebVdCFtuC8Q7 /QJjb9WtLlWBDInZsXGcz9PA872wo9S/mVLYrQMj6jiAAiejoDoVpm1OPma5xzE= X-Google-Smtp-Source: AGHT+IHtuQXvmrhkkFiEnHekC/5NQfc0+553ULsBowWpY0clJhHJiTSDhMUI0CtNFYI+isWQOpUYYQ== X-Received: by 2002:adf:f7c5:0:b0:367:8876:68e6 with SMTP id ffacd0b85a97d-371946a5175mr2178345f8f.48.1723821250458; Fri, 16 Aug 2024 08:14:10 -0700 (PDT) Received: from krzk-bin.. ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-371898ac2d1sm3854184f8f.109.2024.08.16.08.14.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 08:14:09 -0700 (PDT) From: Krzysztof Kozlowski To: Sudeep Holla , Cristian Marussi , arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH] firmware: arm_scmi: Simplify with scoped for each OF child loop Date: Fri, 16 Aug 2024 17:14:07 +0200 Message-ID: <20240816151407.155034-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_161414_048538_F13E58A7 X-CRM114-Status: GOOD ( 11.58 ) 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 Use scoped for_each_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski --- drivers/firmware/arm_scmi/driver.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 33676b6ece95..2b9c38f55989 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2726,14 +2726,14 @@ scmi_txrx_setup(struct scmi_info *info, struct device_node *of_node, static int scmi_channels_setup(struct scmi_info *info) { int ret; - struct device_node *child, *top_np = info->dev->of_node; + struct device_node *top_np = info->dev->of_node; /* Initialize a common generic channel at first */ ret = scmi_txrx_setup(info, top_np, SCMI_PROTOCOL_BASE); if (ret) return ret; - for_each_available_child_of_node(top_np, child) { + for_each_available_child_of_node_scoped(top_np, child) { u32 prot_id; if (of_property_read_u32(child, "reg", &prot_id)) @@ -2744,10 +2744,8 @@ static int scmi_channels_setup(struct scmi_info *info) "Out of range protocol %d\n", prot_id); ret = scmi_txrx_setup(info, child, prot_id); - if (ret) { - of_node_put(child); + if (ret) return ret; - } } return 0;