From nobody Fri Dec 19 16:43:16 2025 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) (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 2E54113F45F for ; Mon, 26 Aug 2024 08:21:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.255 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724660463; cv=none; b=omEY+CrLMfyDW+hlCTEe92WSg4JbypNKth6x47l8RM8T0pbBYMFi1mPsyaS+DyTm5+lE96lhxGkO0jwsW5r4OV2911lh1kDAQ8Yb0IN6w+4gZJhYAzryhtOc4dTlm6CQf/x3uoOH6/SCVOTRhR5LbSsqGTywZdBKyMFpXIgvzDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724660463; c=relaxed/simple; bh=nYyO6LwgVFzXt2p7i0oGLkc8P1po82g1BGlszDnuFBo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qqmXdeVpeIsxRD70gwSLn2KEaeWeLRTXjdHGZ+oJDM94ID9cronP4N6CkFF8hhVMEytZ5H3ekPNvnxx7ASX3CqaFPeovLsaLMsNAbhZX+onlvcuRt4vpcJxQxGYtpuslbOtRc4zn5mWM/O7h6hhQPKi8A5LnhC66KQt0TWw9F50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.255 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4WskBQ14dKz14Dk8; Mon, 26 Aug 2024 16:20:14 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 8872714037E; Mon, 26 Aug 2024 16:20:59 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 16:20:59 +0800 From: Jinjie Ruan To: , , , CC: Subject: [PATCH -next 01/12] mfd: max77620: Use for_each_child_of_node_scoped() Date: Mon, 26 Aug 2024 16:28:36 +0800 Message-ID: <20240826082847.2591036-2-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826082847.2591036-1-ruanjinjie@huawei.com> References: <20240826082847.2591036-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemh500013.china.huawei.com (7.202.181.146) Content-Type: text/plain; charset="utf-8" Avoids the need for manual cleanup of_node_put() in early exits from the loop. Signed-off-by: Jinjie Ruan --- drivers/mfd/max77620.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c index 74ef3f6d576c..89b30ef91f4f 100644 --- a/drivers/mfd/max77620.c +++ b/drivers/mfd/max77620.c @@ -400,7 +400,7 @@ static int max77620_config_fps(struct max77620_chip *ch= ip, static int max77620_initialise_fps(struct max77620_chip *chip) { struct device *dev =3D chip->dev; - struct device_node *fps_np, *fps_child; + struct device_node *fps_np; u8 config; int fps_id; int ret; @@ -414,10 +414,9 @@ static int max77620_initialise_fps(struct max77620_chi= p *chip) if (!fps_np) goto skip_fps; =20 - for_each_child_of_node(fps_np, fps_child) { + for_each_child_of_node_scoped(fps_np, fps_child) { ret =3D max77620_config_fps(chip, fps_child); if (ret < 0) { - of_node_put(fps_child); of_node_put(fps_np); return ret; } --=20 2.34.1