From nobody Thu Jun 25 00:33:30 2026 Received: from mail.auroraos.dev (unknown [95.181.193.9]) (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 E460419B5B1 for ; Mon, 8 Jun 2026 17:30:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.181.193.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780939817; cv=none; b=mMXzzfrTyI1AVZFQVaE1yUB98qOXYbFJjiGq3tC9lyfHTx3vnHiIyPBpSqG8yJOtkrce+xugRSf9kmmVrjVeZ0lHZ/gxkGm7ZhoQVy0f2EQKweIWIeGDsKPNCy85b+I4Lrq/Lm7IP+XdxZP/VG3mPqASD/3OHGTYH5+kFqRh268= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780939817; c=relaxed/simple; bh=z3fY3kdM5hH1QMNztMBqgsaJIOhmF0qfm6fHKx4H7p8=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Lb34MzYZqUddi39LZykqje2jkpqxjokMWundDQTjmBv0Gu17/88FxsqVnR3LTyS9TSWX4YSjrdLwQJcedEY0QGIOV04V2tASuoV802hRYv+b9q00MPMzxqOtmR3uVEHfFw62F4D+BAh12gFRL9YQgGKbI10wVnDmt6+dJR3btTY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=auroraos.dev; spf=pass smtp.mailfrom=auroraos.dev; arc=none smtp.client-ip=95.181.193.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=auroraos.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=auroraos.dev Received: from wasted (91.78.40.188) by exch16.corp.auroraos.dev (10.189.209.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1847.3; Mon, 8 Jun 2026 20:30:04 +0300 From: Sergey Shtylyov To: Liam Girdwood , Mark Brown , CC: Karina Yankevich , Sergey Shtylyov Subject: [PATCH v2] regulator: of: Drop dead code in of_get_regulation_constraints() Date: Mon, 8 Jun 2026 20:29:25 +0300 Message-ID: <20260608172926.21880-1-s.shtylyov@auroraos.dev> X-Mailer: git-send-email 2.54.0 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: exch16.corp.auroraos.dev (10.189.209.38) To exch16.corp.auroraos.dev (10.189.209.38) Content-Type: text/plain; charset="utf-8" From: Karina Yankevich In of_get_regulation_constraints(), the variable suspend_state is either assigned &constraints->state_* pointer (that apparently can never be NULL) in the *switch* statement at the start of the *for* loop or that loop just skips the current iteration using the *continue* statement; thus the 2nd (after the of_get_child_by_name() call) *if* statement's condition would never be true. Hence we can drop the dead code... Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool. [Sergey: rewrote the subject/description] Signed-off-by: Karina Yankevich Signed-off-by: Sergey Shtylyov --- The patch is against the for-next branch of Mark Brown's regulator.git repo= ... Changes in version 2: - rewrote the patch subject/description; - refreshed the patch. Here's the link to version 1: https://lore.kernel.org/all/20231218095707.2625407-1-k.yankevich@omp.ru/ drivers/regulator/of_regulator.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regula= tor.c index c0cc6cc0afd8..d873b7e2dd90 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -278,10 +278,6 @@ static int of_get_regulation_constraints(struct device= *dev, suspend_np =3D of_get_child_by_name(np, regulator_states[i]); if (!suspend_np) continue; - if (!suspend_state) { - of_node_put(suspend_np); - continue; - } =20 if (!of_property_read_u32(suspend_np, "regulator-mode", &pval)) { --=20 2.54.0