Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp146117lqd; Tue, 23 Apr 2024 18:53:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWyd5sW7zKoMDL1oPimBPMayNfmvX4IkjAyrG7iRe0Pq8fzXmOEaD5EQr9kBu4VvBwT6DoM5nICgIqgN7l+SRNUCizL0430hWH7p9c/Og== X-Google-Smtp-Source: AGHT+IHEVySbvvVtLTCVzVRLJu9vdIxxCETWMST5CtzqHFfqDQNUmF8eMbIsSLVhhl2DrXfz2z7n X-Received: by 2002:a19:7413:0:b0:516:d09b:cbe4 with SMTP id v19-20020a197413000000b00516d09bcbe4mr940478lfe.53.1713923599085; Tue, 23 Apr 2024 18:53:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713923599; cv=pass; d=google.com; s=arc-20160816; b=h721L9zBYr4VKc1Hqrc13P+r8DMjnPI8y/3tcv91cZLTMPTTiXuo0EkxxGWE+ghnDB R3fe+Sxr7q7BV8q5bV/OyaIpQy+5HBQBF0tUJ/ZVsz7qGOZefpmvEle1vT1a75wUAlwQ vux80/oXm9+iyZWh3aliM+jdLtmGRiBKg0xzbe5cI2wPqGc0h0cZ7zwGN73y8fLLl43A NyrbSjOr2CeJzniGpCZJGZWFuA4+yz/Qttwa2CtLuZSPLEMYsDKJ+CL2N1gUNJjOEBih 689AVjDoPSc8nU5kANYQzvcjvQNRrPLdC1WV6hZFKrg7RwO5HDW7aFN3/4EUqME6VTGM CgAA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=+boyDLjblvWwLLkrJLcGOfn00OcpsPMnSVwVZAPX45M=; fh=k0om3nu2YvOp7x3VtOxFhNClH0GXNb9XnZqzIRwSoOo=; b=gLBiYvVCmBAxvhwBdm03GZFL8O98ZTCS2y7+DqfM1kQZJ74w47yiQn2wJnCaPVJFLm wfOD/OHnbBjfhpXUdWPOY56hnolVYTA6++T2OjrYCz3TACIMi++1oVKFMnvvq2NmOcDG dE/QyRsIMe4XMrArxTruKdUKa8lzSYkjSUc+Y6mPWyOkuB2l96J4wgKkBeLmDSZx1mVV fuyzSz4Ek6hSQCezoBq7KJDFkVSY2RJBq80bJcfl8QrVH4SdCeblk7UGyLFZKCqwYk6Q Fdch61arDrEOo4LwBXveTOKtcbveMkS+O81I0R9DbP8qwQtVxurm9K9K1hHu+k+BWQZq Y6qw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="aAU/aA/F"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-156110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156110-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id hd17-20020a170907969100b00a571c511dbasi2733282ejc.445.2024.04.23.18.53.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 18:53:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="aAU/aA/F"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-156110-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156110-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C061F1F24017 for ; Wed, 24 Apr 2024 01:53:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 367A2125D5; Wed, 24 Apr 2024 01:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aAU/aA/F" Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E824101F2; Wed, 24 Apr 2024 01:53:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713923589; cv=none; b=qjRSpMdaRiaRPv3xfsOg6MBJQiaOS9j1jwvztf0KcSba7SPVfERZEDoFLtshl/MgkYmOBGlUxPosN8/e/naCJ5OhkDP5s37acwNk9KAPsSN8y1CcHYOfQhtscxL0re0JsHCZr/gFH0+bx03Eneo01AI8Edp1Qa+B1uL+gLHDaAw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713923589; c=relaxed/simple; bh=PThITv7YBA7tYPbMYW9Vhx8MShzInnPREyhu+swHDo0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=G7fWWd+OwZzp7sC9xbc18a8CBy86SFUocYcM2v0uE2TwZQHclUKh82BEMbmn9VOZf8mcG6Tj3x17MrP7c885FhtTK3wOoDNbKZgzjt5HGjAj/ddUs4i7lgqmBHJ5pMGwN0aHzKu9vqSbGK1LZJTGUdZE2XcMLJ/N9zYoCAFZwNA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aAU/aA/F; arc=none smtp.client-ip=209.85.160.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-22ed075a629so2542290fac.3; Tue, 23 Apr 2024 18:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713923587; x=1714528387; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+boyDLjblvWwLLkrJLcGOfn00OcpsPMnSVwVZAPX45M=; b=aAU/aA/FtBvxN0uzuNAsnvB6YKxqPX5fAegN/QOVsPR4QahTndQ0NK0YZVadDorV3C bv2Gx2buUf9UYB7IwSfoh3HoI97EaQ0mM7SE4wdSCFL7Zp/jmW7XU92wxMQv6J/4Biiu XYnF4eE0Exs3ikxfwTU8kaLTLIZ7IqyyMifbNvxbyYe5hp8bKxulsupPgSCHXwWBlrSO 3qcty1NpyoshGk/q7Xt3nUpOz2GJMCy0eBS2ndvIfP0PqqVFno7j1tXkOC8DSGA/Tu2B KR9NZ565ePP8zgOAnDxFyMI6ahidILAyNqlQmHGYM+mOcQ7YPL9qbNmBkK+tgeUk4PH5 fQ7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713923587; x=1714528387; 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=+boyDLjblvWwLLkrJLcGOfn00OcpsPMnSVwVZAPX45M=; b=hU9hO5synsMavBMa13HDo5kq4501TwthYwMZXrg8Oo4cGjSCBj4CgTnBASGgEJE1Jz f+SAsY+VoVwRFghBIZFhI0neTvgj/zSeKMNPxPN/grM/3ikz48kHwU1hBT6FXS1hUeC3 ZKDQwjgV0FMS/JsdQi6jd5f2XQevzz3I/z0p/7slyAuFIgpLN9HEBCLmtmZv/J4Q3GCA nFgePy0tZJHIrXXlXfr1xTC6MdPDLwqS0v6nachfrKgLn6Y+xJxFQzzO0FWBwQtboe7Q Igg8UJcPaTg+onOzutmP47rEoMFEmqg5jvo9Zu2yxXG1oU6oHKDMjktQWutPPt34JL7n b3ZA== X-Forwarded-Encrypted: i=1; AJvYcCWEdW9MGYfpRcQElhYVmzXnKljfSWSip02ug0jkXVnqgRO6uzjR99YYfStyiRJ7wwG64FKBN0DPE8kXFtM47a92hZ6AD2A4TZrljTcHukXAwPIAiktr1FwkB0VY553wCnMZP61rWtyOzHM= X-Gm-Message-State: AOJu0YwvWMnyyT0WawmPFK8oy2nXB73457KeH0n+VFfngguxNxu/WlEC 4cA83wfLiODh8f8dEnquR4OJ1E1qgh+sFBZNf5RJ/h3K9DnUQcfp X-Received: by 2002:a05:6870:a345:b0:238:b140:1ab with SMTP id y5-20020a056870a34500b00238b14001abmr1132265oak.48.1713923586779; Tue, 23 Apr 2024 18:53:06 -0700 (PDT) Received: from localhost ([2806:103e:22:49d9:6aef:e478:d2bd:bbe]) by smtp.gmail.com with ESMTPSA id bm43-20020a0568081aab00b003c4f39fb9e7sm1899925oib.36.2024.04.23.18.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 18:53:06 -0700 (PDT) From: Miguel Miranda To: thierry.reding@gmail.com, jonathanh@nvidia.com, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, javier.carrasco.cruz@gmail.com, julia.lawall@inria.fr Subject: [PATCH] drivers/soc/tegra: Replace dev_node refcount management Date: Tue, 23 Apr 2024 19:53:06 -0600 Message-Id: <20240424015306.1796838-1-mmikernel@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Remove the manual refcount management of device_node and instead, use scope-based resource management. While the pointer never gets out of scope it reduces somehow the risk of missing the of_node_put() call. Suggested-by: Julia Lawall Signed-off-by: Miguel Miranda --- I only have a deprecated jetson nano dev-kit, but need to test this on hardware. I am exploring options to build a rootfs to test this using qemu-system-aarch64. --- drivers/soc/tegra/common.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c index dff6d5ef4e46..94d11102d90f 100644 --- a/drivers/soc/tegra/common.c +++ b/drivers/soc/tegra/common.c @@ -28,14 +28,12 @@ static const struct of_device_id tegra_machine_match[] = { bool soc_is_tegra(void) { const struct of_device_id *match; - struct device_node *root; + struct device_node *root __free(device_node) = of_find_node_by_path("/"); - root = of_find_node_by_path("/"); if (!root) return false; match = of_match_node(tegra_machine_match, root); - of_node_put(root); return match != NULL; } -- 2.25.1