Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp101410iog; Thu, 23 Jun 2022 23:37:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t0K+3mrPtPKU+BgzJ8//lPkY9WYPgJ1fZX+ihSs+YG9oFBP18ZG/+2H58Dz5DKF/281gfZ X-Received: by 2002:a17:907:930:b0:711:da36:62f7 with SMTP id au16-20020a170907093000b00711da3662f7mr11763021ejc.468.1656052670143; Thu, 23 Jun 2022 23:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656052670; cv=none; d=google.com; s=arc-20160816; b=HYsAljW/P0Oq3uNsh9Pq81trTTs9f6uLjbf2VtYXiSOdmDp7ooH3SzVgQdmAuYTRZ0 CqkcFp53iTLV3oQ+R5a8IzuffpW4vmlZHqZvgzhsJgLgs54yI391hORyX6vIB8acD1Ny Lhd5Rr9B+zsxjZGuvWcMRq2MepR4k7O3Iq2gluec1vrA6rxO06W+Ss8ofo2wIElRGF7g gAotEcbKcP82OmPFYSdG1h2FsRBAxi5hN1gGkVi7C2U5ufl/Its4t/4REr4D5WXm3qUW 00BJrJPLPlr7FFnK61IwBuh+a4TZedF/YoFDvCAU7qAp4O5ae6jIJty1+o5OtK/c8UQk TYiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=1iT6GkonFIg7DTmZ5DQq/9/ZFJHzEttvXdiZfPCeGGA=; b=p5CmJgaDS1cZ/inZLIiYgAsuabmV/S4yfTr7uh2aszzLqBfgPy5PkDXiOMv8ZXXDL2 nSG8K6prN0W4aD/JNrfTmJ3/hO8S1PrbyD+vNKxzVgTD39bH4VYX27VaguG+yRitckGr B+VzNK0mqXVcMDUtYX5dUn01///S6hCuzyx7FVGCNbuQoypB2CVkG6aAZpzmQ0ZcFXyn vjKf9ChLuOVe0aKWCni/cydWGbDwSHYMtEkALQT8zhZwZLBQ7MAzfkTtInR8YAOcvRpC 4InZoAVPxrw+pgLLhHIBr546scZCT5/HnAFFMz4FCxskRcDbO5ZaYxlBpQNBL9a+Xv9k 5HMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb10-20020a0564020d0a00b0043556ce2480si2345954edb.450.2022.06.23.23.37.25; Thu, 23 Jun 2022 23:37:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbiFXGZh (ORCPT + 99 others); Fri, 24 Jun 2022 02:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiFXGZe (ORCPT ); Fri, 24 Jun 2022 02:25:34 -0400 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F8144F9FD for ; Thu, 23 Jun 2022 23:25:33 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0VHFjIFX_1656051917; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VHFjIFX_1656051917) by smtp.aliyun-inc.com; Fri, 24 Jun 2022 14:25:28 +0800 From: Jiapeng Chong To: harry.wentland@amd.com Cc: sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jiapeng Chong Subject: [PATCH] drm/amd/display: Use swap() instead of open coding it Date: Fri, 24 Jun 2022 14:25:11 +0800 Message-Id: <20220624062511.50532-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This was found by coccicheck: ./drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c:2959:30-31: WARNING opportunity for swap(). Signed-off-by: Jiapeng Chong --- drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c index 25791ed0559d..e832fec8d844 100644 --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c @@ -2906,7 +2906,6 @@ static enum bp_result construct_integrated_info( struct atom_common_table_header *header; struct atom_data_revision revision; - struct clock_voltage_caps temp = {0, 0}; uint32_t i; uint32_t j; @@ -2951,14 +2950,8 @@ static enum bp_result construct_integrated_info( for (i = 1; i < NUMBER_OF_DISP_CLK_VOLTAGE; ++i) { for (j = i; j > 0; --j) { if (info->disp_clk_voltage[j].max_supported_clk < - info->disp_clk_voltage[j-1].max_supported_clk - ) { - /* swap j and j - 1*/ - temp = info->disp_clk_voltage[j-1]; - info->disp_clk_voltage[j-1] = - info->disp_clk_voltage[j]; - info->disp_clk_voltage[j] = temp; - } + info->disp_clk_voltage[j-1].max_supported_clk) + swap(info->disp_clk_voltage[j-1], info->disp_clk_voltage[j]); } } -- 2.20.1.7.g153144c