Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp988508pxb; Wed, 6 Apr 2022 06:07:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ2d/XXz+ZyA0PlvWz/1tJuIsN09fKVzOOwZb9spGnQjGo23LH00EULzWs3lZe3fdrjpS5 X-Received: by 2002:a62:1407:0:b0:4fd:a8fb:9915 with SMTP id 7-20020a621407000000b004fda8fb9915mr8761958pfu.12.1649250465228; Wed, 06 Apr 2022 06:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649250465; cv=none; d=google.com; s=arc-20160816; b=l01ZUc4gRJRBCWgPb7QWUbrsdrPdHMzMAGUvs8gytvz/eqwk2vtI1TBLMe/RzyI6BT ch5f9o5yz5McxdAI1Ew2YaF33HiLJ1KzCjP9CpJHbd5eJwHIG3P1lJwX0U8SBKU45yb0 u29xJcVppVdTDM0nTZzQ3Peu4kMvCw8QU5ASg6ZO19yZFh43j21CgSZRlY+LIDmUHb2Z tf2U085Cv+KyPka2bsukMnfBf0qxe+gO+vFG2ROgTY4wgtkS40aLVmEB3G+wsEQAa1wo Wsyk2suGrCAPCu9BzF8mLOUIF7CKDwlzS9uwCOUiZD6aCnRRTAWsOQSexaMMLAibURqb 0+ZA== 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:dkim-signature; bh=hKOYgRsFR0laaLuRCNcCw4kzlI2NLR4gbF3cCQ5uqJo=; b=Yo+iH1VHCAvhMeoVufCz61g/RKj2R6rcinCP/B59kccJ387Y0lBjdcw1EUsUQj3AnE LFhq/WzuYl8MRd6ki7U7F3uJMgiRDBQ6IJk4r/L0wQVWHrS0kkZ1rlHxgBt+rb0KbvbM MLO1rXoC+Uzu59RbWA6yHVQg4x0G+tFLZ40a0/YMRe/5YRoj89FZKTc0xfbx5VHYHeuz UrsL+8PDynHn9/QOCGMzYos8X/89atzqVOKfa43k60dVOwjH/el2Y0u5Az9bZNs7Y7OI 59EgTN21DCOIEGDdUftdIzqAKHq21msmXqmzywo9prDAYRrIgXbaeMRXPU9xRCQ/r38s 3+Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BVr2YLDF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q6-20020a637506000000b0038430b87da9si15909515pgc.704.2022.04.06.06.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:07:45 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BVr2YLDF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 488EF672655; Wed, 6 Apr 2022 03:30:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1454049AbiDEWhf (ORCPT + 99 others); Tue, 5 Apr 2022 18:37:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1572975AbiDERi3 (ORCPT ); Tue, 5 Apr 2022 13:38:29 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC9A6B8202 for ; Tue, 5 Apr 2022 10:36:29 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id h11so18095903ljb.2 for ; Tue, 05 Apr 2022 10:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hKOYgRsFR0laaLuRCNcCw4kzlI2NLR4gbF3cCQ5uqJo=; b=BVr2YLDF7/GGyceZtEIm5ngSV0ZtewWefzWQMZJrDgToXi9Raa7zKK44DLjRVzPSqP rsZLh6unBOu9b8DWnbG/ulO/wlcI8YZUN880shObyr6Um/tVfTBF3cpDo2m1IIKVXFXc zuEn6HEaMmx6K8GTOTGE4Mblhp0TiZE2FitQh5Rr8gfwTotRoebmdrpUBkbSJQqBH8oj W1xHElC1X+BR49CMwpETUiRpdxyPiM6vQ59CHEktyrUKPaIaztu332GBp/js3CB90ZAn r78X3f+ujP//edJmpYijII+/KADwpeHvELEGDupRr4+0b1KDmJ35cLhgmUM4MdeHvqp9 rfDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hKOYgRsFR0laaLuRCNcCw4kzlI2NLR4gbF3cCQ5uqJo=; b=0JSYmqfoFhsvXI90WHtgPkA1/AT0y7s3iP58rb9Twg6AYJq35Q919S5jnXI/l3Hc8G xqBgrRDm3t2hboKXOuiZ13NPlwo8BK0jxq4N4Zb3reUhu5BlC/6GypUoLxe3cuPx1SKp CEiVRUlB8TRYp+XZl5zOWv/jdclPWIqJrWX8LhO8uVYFSU7ThYEjLy+UUfDnd1rtG4Vu ml09q4S3fQW3JDUU8RSFQeDiAHAyUKRNMu5uGnzU4hhUC7vfKVDrm0Prl1boKNCHJ+nc 03jZVJNfheIzcVZJjXYXjpIMitC/40E+l7IK+0wndRdd+ThDxaX+d+mDRw7SQflqsOjD nTdA== X-Gm-Message-State: AOAM5302mvcsr7aJhOHQwrrrbRMKHbfnbrCcsyMTZ6hjbdJhWVSd9jOT FWEZzYontzq73iAleLB3GwM= X-Received: by 2002:a2e:a490:0:b0:249:894b:ce20 with SMTP id h16-20020a2ea490000000b00249894bce20mr2753320lji.301.1649180187930; Tue, 05 Apr 2022 10:36:27 -0700 (PDT) Received: from noname.. ([2a02:2698:8c2a:226e:6d9:f5ff:fecb:a8ab]) by smtp.googlemail.com with ESMTPSA id j11-20020a196e0b000000b0044a3f007893sm1563825lfc.286.2022.04.05.10.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 10:36:27 -0700 (PDT) From: Grigory Vasilyev To: Rodrigo Siqueira , Melissa Wen Cc: Grigory Vasilyev , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Jani Nikula , Jiawei Gu , Lucas De Marchi , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amdgpu: Senseless code and unnecessary memset Date: Tue, 5 Apr 2022 20:36:31 +0300 Message-Id: <20220405173632.2663-1-h0tc0d3@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Using memset on local arrays before exiting the function is pointless. Compilator will remove this code. Also for local arrays is preferable to use {0} instead of memset. Mistakes are often made when working with memset. Signed-off-by: Grigory Vasilyev --- drivers/gpu/drm/amd/amdgpu/atom.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c index be9d61bcb8ae..537e48fbbe6b 100644 --- a/drivers/gpu/drm/amd/amdgpu/atom.c +++ b/drivers/gpu/drm/amd/amdgpu/atom.c @@ -1538,11 +1538,9 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios) int amdgpu_atom_asic_init(struct atom_context *ctx) { int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); - uint32_t ps[16]; + uint32_t ps[16] = {0}; int ret; - memset(ps, 0, 64); - ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR)); ps[1] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFMCLK_PTR)); if (!ps[0] || !ps[1]) @@ -1551,10 +1549,6 @@ int amdgpu_atom_asic_init(struct atom_context *ctx) if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) return 1; ret = amdgpu_atom_execute_table(ctx, ATOM_CMD_INIT, ps); - if (ret) - return ret; - - memset(ps, 0, 64); return ret; } -- 2.35.1