From patchwork Sat Apr 16 15:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 12815889 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3DC5C433F5 for ; Sat, 16 Apr 2022 15:41:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BBB0410ECEE; Sat, 16 Apr 2022 15:41:29 +0000 (UTC) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7EB1310ECEE; Sat, 16 Apr 2022 15:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:subject:message-id:mime-version; bh=1wVLOpHzKPeQpjuFk22c/NclCNO9ofoGkvdqY8RWiGw=; b=RdHqWJShJnOsQMHqDMKa0/8PH88tNuKWWYpE8xdgMdOiNSpZth3d/J9C Y5X10l/ZqcEuFXKxaT0c08t0JVCi2B24ExsNgTLPLjrcPzLJHEw4lRKSz mzNSHTT9P3keFER8I2PJmMQ05BpCG9HJfMu0bOYyd4BEWA8GTu4+GHXGH k=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.90,264,1643670000"; d="scan'208";a="32021706" Received: from 203.107.68.85.rev.sfr.net (HELO hadrien) ([85.68.107.203]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 17:41:24 +0200 Date: Sat, 16 Apr 2022 17:41:24 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: kbuild-all@lists.01.org, lkp@intel.com, linux-kernel@vger.kernel.org, Denis Efremov , Julia Lawall , Evan Quan , Alex Deucher , =?iso-8859-15?q?Christian_K=F6nig?= , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amdgpu/powerplay/vega10: fix minmax.cocci warnings Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: kernel test robot Use max to simplify the code. Generated by: scripts/coccinelle/misc/minmax.cocci CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot Signed-off-by: Julia Lawall --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 028192fea1de083f4f12bfb1eb7c4d7beb5c8ecd commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax script :::::: branch date: 17 hours ago :::::: commit date: 12 months ago Please take the patch only if it's a positive warning. Thanks! drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c @@ -345,12 +345,10 @@ static int vega10_odn_initial_default_se odn_table->min_vddc = dep_table[0]->entries[0].vddc; i = od_table[2]->count - 1; - od_table[2]->entries[i].clk = hwmgr->platform_descriptor.overdriveLimit.memoryClock > od_table[2]->entries[i].clk ? - hwmgr->platform_descriptor.overdriveLimit.memoryClock : - od_table[2]->entries[i].clk; - od_table[2]->entries[i].vddc = odn_table->max_vddc > od_table[2]->entries[i].vddc ? - odn_table->max_vddc : - od_table[2]->entries[i].vddc; + od_table[2]->entries[i].clk = max(hwmgr->platform_descriptor.overdriveLimit.memoryClock, + od_table[2]->entries[i].clk); + od_table[2]->entries[i].vddc = max(odn_table->max_vddc, + od_table[2]->entries[i].vddc); return 0; }