Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1414703lqa; Mon, 29 Apr 2024 07:56:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVG43VzOnc+g9RRviprIAiHDT0gu6auWjmvYXdzXbLVHUbAEGrX+N6drGEpW5rrUnhXxBxjxk2KIy7aWxjw6DmV+E1HIAiDc7JAFtMEHA== X-Google-Smtp-Source: AGHT+IEBm9EviELcbYUc02iDNOvMi+8F5kjKXgPr8nnFMUpWTjlx10fdSbsvFAhOpqoqrLsvXBMR X-Received: by 2002:a19:f719:0:b0:516:d18b:eaea with SMTP id z25-20020a19f719000000b00516d18beaeamr6305745lfe.33.1714402566773; Mon, 29 Apr 2024 07:56:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714402566; cv=pass; d=google.com; s=arc-20160816; b=zdo4kuIG2OUmQqlw80zPgTBvISWOaI1RHRq8yCnI0Ky/5qduTVol8HsXjiK9tlP3It +R0kECj3kbkiD4nTMZYVM1n+WsymsA+zHohdDi0lV55gGdNPDhQwMW8xwN9R9cHNUnN+ XmSD2uFOoRTjg9ut4Ehshn6W/2i4p1fcIvUkDTegrK0+dqr3z0o21ekb+AfiYOy3D40A WnWh2Rir+fMB4Sirhzg0mE9v3Zah8d8UVIzAtwIcpWiJNx2cBHBXdbKbMEep278LYtrN 2xEQg72surrPLstyMeg9ubbI5ToDCppfq26qM+6+sE0l96ebgK3UffSlJDTr1imElPTf oc9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:dkim-signature; bh=EcZUaEqjg6vd40bVwK7oqpSBmZiwfxAEo284/aXejGI=; fh=9+JPiKUqmiwg7nrgynbn+qu8x0UhUJwyp0gAHVwwYQs=; b=u2GgQEZ1aXBFWp6pHOUxaN4Z+3+V2+crnBzrIWsDpqThgfT2yPSPAjyCc89QJCps+K WQek5pj25RQLUyoh7S+8vEHV7C6uTdYxFLblFCkj4yhqPSrHtspyLrR4vIdwubsMVtUm sXvukR8ngAYR/jlFNaBfv44KlVfZy6Vz0SHK+gTA9im1I/SPWs9N+0KHY7KVDc9hD29Z z+nbo0ec9+LF2OTTNtR4KmW7ssMCd96Bz6y9WHVE2z1B8uzFo/wo2ccSxxz3L2sHynFC cvXJHBQVbBcoGKAglOxy3ppe1DN/9POlwJdXneFwpYBOEGNIT8bLOkeewQrnqMf/E+3A Xdjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rere.qmqm.pl header.s=1 header.b="OuEMaWs/"; arc=pass (i=1 spf=pass spfdomain=rere.qmqm.pl dkim=pass dkdomain=rere.qmqm.pl dmarc=pass fromdomain=rere.qmqm.pl); spf=pass (google.com: domain of linux-kernel+bounces-162499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m13-20020a1709061ecd00b00a520ce94de8si13855774ejj.1009.2024.04.29.07.56.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 07:56:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162499-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=@rere.qmqm.pl header.s=1 header.b="OuEMaWs/"; arc=pass (i=1 spf=pass spfdomain=rere.qmqm.pl dkim=pass dkdomain=rere.qmqm.pl dmarc=pass fromdomain=rere.qmqm.pl); spf=pass (google.com: domain of linux-kernel+bounces-162499-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=rere.qmqm.pl 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 64C6D1F23C3B for ; Mon, 29 Apr 2024 14:56:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B52F80029; Mon, 29 Apr 2024 14:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="OuEMaWs/" Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) (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 6D0207EEF2 for ; Mon, 29 Apr 2024 14:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.227.64.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714402558; cv=none; b=qmbWJdHci7XZ+aRAYyKqqEeNxk1B/uMFIE7IJVAXJMmNaHSLVy8AMxZwV6i/ZaqUiTFh+xo/jeqePhFg0X+HcBFu2+SJp6yFlXs88Uk8NqZQa+X9VYDJOgQAO4JcxA3AJ4twMFZ+4B3RNp/CzNIzRzCTP/ko1Vu0qtShWj4rPmE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714402558; c=relaxed/simple; bh=cCS+DVLBcUHkUuYmcqkFBMezGuTJlFBBRX3YxppQm40=; h=Date:Message-Id:In-Reply-To:References:Subject:MIME-Version: Content-Type:From:To:Cc; b=fryk4p6L2NSo51AKjG1i22sGgXoY9itqL3Etb5bDPSMy/eFAf8uEF0HZe7KMZEXnzyhAWMf4D6RQ3pL3GzNn3DH7pg6+1u77qNxCSUxlRmQ0NkVKiAOrTizacVPpfWCwwx/3loHlJ/e0TMXuQW7M/hnRiZEnwPAjNdge43yRAdg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rere.qmqm.pl; spf=pass smtp.mailfrom=rere.qmqm.pl; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b=OuEMaWs/; arc=none smtp.client-ip=91.227.64.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=rere.qmqm.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rere.qmqm.pl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1714401928; bh=cCS+DVLBcUHkUuYmcqkFBMezGuTJlFBBRX3YxppQm40=; h=Date:In-Reply-To:References:Subject:From:To:Cc:From; b=OuEMaWs/7pg3zJyycDLH8eqqRUDlq91Rjfc35++RcaAXUaxMaDHlQNl4iwWeb5sCs h9AY335esHMkvPbm4Q+uo5PIy1ZzCOw5oD123CbkFuaP10Bk3uP6DfE/OYFT4CHcqC 91BemroiHoJCZwDXJdLA9Ubj5TSm9WAB7cltUkxYolEaeejAzBb8n51P3d31hIXQ7L OfiKEA7P1qzeyhML7P6QN/m53IXqpMN6YtPcoOcAlXNgzhdwczfQSvvZ0co09Hwkbx 2qJpJqvE6ufCkDLzypjtDACzeoEdFt/aB1vY9A9mlLIST9LgxBRQtcjev+syCTUFf6 6Ti2RcRrPYaWg== Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4VSmMr3f1NzCW; Mon, 29 Apr 2024 16:45:28 +0200 (CEST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 1.0.5 at mail Date: Mon, 29 Apr 2024 16:45:28 +0200 Message-Id: <079287cf3922f3b38a4f751f6e9097816037dd8e.1714399603.git.mirq-linux@rere.qmqm.pl> In-Reply-To: References: Subject: [PATCH v2 03/12] regulator/core: of_get_child_regulator: remove goto Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org Because of_node_put() handles NULL properly (like kfree() et al) we can call it also after the loop ends (due to child == NULL). This makes the gotos redundant. Signed-off-by: Michał Mirosław --- drivers/regulator/core.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 5db3bf08145c..3d7147fabbed 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -438,18 +438,15 @@ static struct device_node *of_get_child_regulator(struct device_node *parent, for_each_child_of_node(parent, child) { regnode = of_parse_phandle(child, prop_name, 0); + if (regnode) + break; - if (!regnode) { - regnode = of_get_child_regulator(child, prop_name); - if (regnode) - goto err_node_put; - } else { - goto err_node_put; - } + regnode = of_get_child_regulator(child, prop_name); + if (regnode) + break; } - return NULL; -err_node_put: + /* Release the node if the loop was exited early. */ of_node_put(child); return regnode; } -- 2.39.2