From nobody Mon Feb 9 07:57:35 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A856EB64D7 for ; Wed, 21 Jun 2023 11:58:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231440AbjFUL6p (ORCPT ); Wed, 21 Jun 2023 07:58:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbjFUL6l (ORCPT ); Wed, 21 Jun 2023 07:58:41 -0400 Received: from tretyak2.mcst.ru (tretyak2.mcst.ru [212.5.119.215]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6C01710 for ; Wed, 21 Jun 2023 04:58:34 -0700 (PDT) Received: from tretyak2.mcst.ru (localhost [127.0.0.1]) by tretyak2.mcst.ru (Postfix) with ESMTP id DE46410239C; Wed, 21 Jun 2023 14:58:29 +0300 (MSK) Received: from frog.lab.sun.mcst.ru (frog.lab.sun.mcst.ru [176.16.4.50]) by tretyak2.mcst.ru (Postfix) with ESMTP id D7DFF102390; Wed, 21 Jun 2023 14:57:44 +0300 (MSK) Received: from artemiev-i.lab.sun.mcst.ru (avior-1 [192.168.53.223]) by frog.lab.sun.mcst.ru (8.13.4/8.12.11) with ESMTP id 35LBvhXh010817; Wed, 21 Jun 2023 14:57:44 +0300 From: Igor Artemiev To: Alex Deucher Cc: Igor Artemiev , Daniel Vetter , David Airlie , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [lvc-project] [PATCH] drm/radeon: remove useless conditions Date: Wed, 21 Jun 2023 14:56:17 +0300 Message-Id: <20230621115617.2126804-1-Igor.A.Artemiev@mcst.ru> X-Mailer: git-send-email 2.39.0.152.ga5737674b6 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Anti-Virus: Kaspersky Anti-Virus for Linux Mail Server 5.6.39/RELEASE, bases: 20111107 #2745587, check: 20230621 notchecked X-AV-Checked: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Comparisons of 'table' and 'vddc_sclk_table' with NULL are useless since 'table' and 'vddc_sclk_table' are initialized by an addresses and cannot be NULL. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Igor Artemiev --- drivers/gpu/drm/radeon/kv_dpm.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dp= m.c index f7735da07feb..17d312ceb6ec 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c @@ -399,7 +399,7 @@ static u32 kv_convert_vid2_to_vid7(struct radeon_device= *rdev, &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; u32 i; =20 - if (vddc_sclk_table && vddc_sclk_table->count) { + if (vddc_sclk_table->count) { if (vid_2bit < vddc_sclk_table->count) return vddc_sclk_table->entries[vid_2bit].v; else @@ -421,7 +421,7 @@ static u32 kv_convert_vid7_to_vid2(struct radeon_device= *rdev, &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; u32 i; =20 - if (vddc_sclk_table && vddc_sclk_table->count) { + if (vddc_sclk_table->count) { for (i =3D 0; i < vddc_sclk_table->count; i++) { if (vddc_sclk_table->entries[i].v =3D=3D vid_7bit) return i; @@ -561,7 +561,7 @@ static int kv_program_bootup_state(struct radeon_device= *rdev) struct radeon_clock_voltage_dependency_table *table =3D &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; =20 - if (table && table->count) { + if (table->count) { for (i =3D pi->graphics_dpm_level_count - 1; i > 0; i--) { if (table->entries[i].clk =3D=3D pi->boot_pl.sclk) break; @@ -666,7 +666,7 @@ static int kv_populate_uvd_table(struct radeon_device *= rdev) int ret; u32 i; =20 - if (table =3D=3D NULL || table->count =3D=3D 0) + if (table->count =3D=3D 0) return 0; =20 pi->uvd_level_count =3D 0; @@ -737,7 +737,7 @@ static int kv_populate_vce_table(struct radeon_device *= rdev) &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; struct atom_clock_dividers dividers; =20 - if (table =3D=3D NULL || table->count =3D=3D 0) + if (table->count =3D=3D 0) return 0; =20 pi->vce_level_count =3D 0; @@ -800,7 +800,7 @@ static int kv_populate_samu_table(struct radeon_device = *rdev) int ret; u32 i; =20 - if (table =3D=3D NULL || table->count =3D=3D 0) + if (table->count =3D=3D 0) return 0; =20 pi->samu_level_count =3D 0; @@ -866,7 +866,7 @@ static int kv_populate_acp_table(struct radeon_device *= rdev) int ret; u32 i; =20 - if (table =3D=3D NULL || table->count =3D=3D 0) + if (table->count =3D=3D 0) return 0; =20 pi->acp_level_count =3D 0; @@ -922,7 +922,7 @@ static void kv_calculate_dfs_bypass_settings(struct rad= eon_device *rdev) struct radeon_clock_voltage_dependency_table *table =3D &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; =20 - if (table && table->count) { + if (table->count) { for (i =3D 0; i < pi->graphics_dpm_level_count; i++) { if (pi->caps_enable_dfs_bypass) { if (kv_get_clock_difference(table->entries[i].clk, 40000) < 200) @@ -1532,7 +1532,7 @@ static void kv_set_valid_clock_range(struct radeon_de= vice *rdev, struct radeon_clock_voltage_dependency_table *table =3D &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; =20 - if (table && table->count) { + if (table->count) { for (i =3D 0; i < pi->graphics_dpm_level_count; i++) { if ((table->entries[i].clk >=3D new_ps->levels[0].sclk) || (i =3D=3D (pi->graphics_dpm_level_count - 1))) { @@ -1905,7 +1905,7 @@ static int kv_get_high_voltage_limit(struct radeon_de= vice *rdev, int *limit) &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; int i; =20 - if (table && table->count) { + if (table->count) { for (i =3D table->count - 1; i >=3D 0; i--) { if (pi->high_voltage_t && (kv_convert_8bit_index_to_voltage(rdev, table->entries[i].v) <=3D @@ -2149,7 +2149,7 @@ static void kv_init_graphics_levels(struct radeon_dev= ice *rdev) struct radeon_clock_voltage_dependency_table *table =3D &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk; =20 - if (table && table->count) { + if (table->count) { u32 vid_2bit; =20 pi->graphics_dpm_level_count =3D 0; --=20 2.30.2