Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3546620pxx; Mon, 2 Nov 2020 11:45:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxN2lQImAZEnm21bT7V7GDvemCBOmNOQqbXy/x7lfsBEpQ/6Z3y0cNuGpaP23ozfxR7MrcH X-Received: by 2002:a17:906:6d0c:: with SMTP id m12mr16966469ejr.498.1604346353215; Mon, 02 Nov 2020 11:45:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604346353; cv=none; d=google.com; s=arc-20160816; b=nXPflbSgpsVVL8nI88g34UrauH9Bqc0Zl/RS+4Q1Zg6pw7bFbfjjO3O8OWlarRZs9G 7C7A604sPwXa+m/N5qCmC5udT9T8Kr8kf22ViG2UbVLvYztShvxlO+TTZCUKrc2SWfKU q+/BCw41HMJw+d2g67Ikwq+qEKXoZj8C0ECLGIsSmwM0BfZQhlebTXA8RlX+D6PP8qnN bG5wImJlhOp3kQNzL6283asUuzkVhqOe3sKwT4BWGgGLNXAOTJXlAiWMraStAee3cati O/+ULnxcwNS8t0E2qsdlv6KFGE9pjjJgfCTtxOGNrw+EazG0PtTlTkI7k4gsuLeXfZxQ Cdrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=f6IxraRxxdSog0pizitTRE7WWJiT5BOAX8ryhNU1NRQ=; b=Yc57CusmIaWSQDD8E4uz1wBHhkDA22tZWQNR75hFMuo0iCOmZao/WDTAkFdMBDiuOZ /VTpIO5ti5mL8VAMZmccKsxE40rjU9RumzKKycQoj90wyRAHapGRaOn74W3rrQ1aMkj5 4b5g6wxF+qN/iZVUP8JQtCjEH7//1lq30WXHR69qK5bqILRwdeLnBngWyi6W8H5k8+YW 9TQv81jNi43xFpvri3wv7QY8lmawM4WqhaT9l7UBWZLg9HzUTXoYAqm+jchRzPgji3vy vAH7zOWsLmtyebXWT1hL+udwFed8ewICiR2vI7K2DUHq/OKwicWcKc3yCy5iTGxq2YgS fKVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VE4XXdGU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc22si12168029ejb.275.2020.11.02.11.45.29; Mon, 02 Nov 2020 11:45:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VE4XXdGU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726236AbgKBTn6 (ORCPT + 99 others); Mon, 2 Nov 2020 14:43:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTn6 (ORCPT ); Mon, 2 Nov 2020 14:43:58 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E585C0617A6 for ; Mon, 2 Nov 2020 11:43:58 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id s9so15965157wro.8 for ; Mon, 02 Nov 2020 11:43:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f6IxraRxxdSog0pizitTRE7WWJiT5BOAX8ryhNU1NRQ=; b=VE4XXdGU8dJOhXS0df4gzIUa6WS+ia5T1R9HtsqvcLzEc19f5G22wX8cdUuvh1t4Aj oA2mShqlCi+ap0GIx3OV/gvMk9mBtgowaTKUAdvgl+ZMmoTHfq0iX94q9Yot+fmtgJiY ADzzadXm3vv7CfN5+jO6Fc2iuegatwOKEZwuWf1EEtzFl3EqYMCAk0bcMdQ8GHiIk3l6 pmnFqEfUKSdzKInQ+Jz/SvlRum4GjYGTzEX9Ck/ndx54ymdapK308qrxEFA5j8feWz1z weE/unWrmE8WvBWellDKcXYg/sysFXHGwOImAAd+Zit4qrbDRMdmD6uowwr4pmxlu/O4 /P2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f6IxraRxxdSog0pizitTRE7WWJiT5BOAX8ryhNU1NRQ=; b=aj4fXPIefE4NADhuljSGDEmc504cjkvBx10obU3StzzKj99sHryUpkzxv0rwabQqFG ca3mZkngMOrBnnT/njISO7CeEzhdUchTXAVyFPyekG5KjWw5s3lhl9+7opP3WqzU9N4b aPGpOvlggYMsRQAngmd+gCJwvY09ZZpeH42cmjgFIYAz6MZDzDowxIVHMzU2MLXXVwbI yLrUM/homJ2C774ZCGsLJCOD2VlztkaZ0V+cXnI85VHMcDB0WZor2EaPiha9wEzjgyn/ cPu6vcqhNeqHrT0wTjTvMLI3wWjF2Uup8PgCwwMEfYHPkoN1rz+eCOQJt3sSfu+Qu6N4 mTIg== X-Gm-Message-State: AOAM533FJVvnaIBdGysO9ikiIdgNbJdw1u9I38jJ4otrnFUKMp/AG3wG I7kCIRzHmC/0FpFWjTq7S8jEcshWNGD/xUftI44= X-Received: by 2002:adf:f246:: with SMTP id b6mr21844385wrp.111.1604346236857; Mon, 02 Nov 2020 11:43:56 -0800 (PST) MIME-Version: 1.0 References: <20201102184147.GA42288@localhost> In-Reply-To: <20201102184147.GA42288@localhost> From: Alex Deucher Date: Mon, 2 Nov 2020 14:43:45 -0500 Message-ID: Subject: Re: [PATCH] drm/amdgpu: do not initialise global variables to 0 or NULL To: Deepak R Varma Cc: Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Airlie , Daniel Vetter , amd-gfx list , Maling list - DRI developers , LKML , Melissa Wen , Greg KH , Daniel Vetter Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 2, 2020 at 1:42 PM Deepak R Varma wrote: > > Initializing global variable to 0 or NULL is not necessary and should > be avoided. Issue reported by checkpatch script as: > ERROR: do not initialise globals to 0 (or NULL). I agree that this is technically correct, but a lot of people don't seem to know that so we get a lot of comments about this code for the variables that are not explicitly set. Seems less confusing to initialize them even if it not necessary. I don't have a particularly strong opinion on it however. Alex > > Signed-off-by: Deepak R Varma > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 46 ++++++++++++------------- > drivers/gpu/drm/amd/amdgpu/atom.c | 4 +-- > 2 files changed, 25 insertions(+), 25 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > index 8ab6126ff70c..6de94c46bc91 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > @@ -94,16 +94,16 @@ > #define KMS_DRIVER_MINOR 40 > #define KMS_DRIVER_PATCHLEVEL 0 > > -int amdgpu_vram_limit = 0; > -int amdgpu_vis_vram_limit = 0; > +int amdgpu_vram_limit; > +int amdgpu_vis_vram_limit; > int amdgpu_gart_size = -1; /* auto */ > int amdgpu_gtt_size = -1; /* auto */ > int amdgpu_moverate = -1; /* auto */ > -int amdgpu_benchmarking = 0; > -int amdgpu_testing = 0; > +int amdgpu_benchmarking; > +int amdgpu_testing; > int amdgpu_audio = -1; > -int amdgpu_disp_priority = 0; > -int amdgpu_hw_i2c = 0; > +int amdgpu_disp_priority; > +int amdgpu_hw_i2c; > int amdgpu_pcie_gen2 = -1; > int amdgpu_msi = -1; > char amdgpu_lockup_timeout[AMDGPU_MAX_TIMEOUT_PARAM_LENGTH]; > @@ -113,43 +113,43 @@ int amdgpu_aspm = -1; > int amdgpu_runtime_pm = -1; > uint amdgpu_ip_block_mask = 0xffffffff; > int amdgpu_bapm = -1; > -int amdgpu_deep_color = 0; > +int amdgpu_deep_color; > int amdgpu_vm_size = -1; > int amdgpu_vm_fragment_size = -1; > int amdgpu_vm_block_size = -1; > -int amdgpu_vm_fault_stop = 0; > -int amdgpu_vm_debug = 0; > +int amdgpu_vm_fault_stop; > +int amdgpu_vm_debug; > int amdgpu_vm_update_mode = -1; > -int amdgpu_exp_hw_support = 0; > +int amdgpu_exp_hw_support; > int amdgpu_dc = -1; > int amdgpu_sched_jobs = 32; > int amdgpu_sched_hw_submission = 2; > -uint amdgpu_pcie_gen_cap = 0; > -uint amdgpu_pcie_lane_cap = 0; > +uint amdgpu_pcie_gen_cap; > +uint amdgpu_pcie_lane_cap; > uint amdgpu_cg_mask = 0xffffffff; > uint amdgpu_pg_mask = 0xffffffff; > uint amdgpu_sdma_phase_quantum = 32; > -char *amdgpu_disable_cu = NULL; > -char *amdgpu_virtual_display = NULL; > +char *amdgpu_disable_cu; > +char *amdgpu_virtual_display; > /* OverDrive(bit 14) disabled by default*/ > uint amdgpu_pp_feature_mask = 0xffffbfff; > -uint amdgpu_force_long_training = 0; > -int amdgpu_job_hang_limit = 0; > +uint amdgpu_force_long_training; > +int amdgpu_job_hang_limit; > int amdgpu_lbpw = -1; > int amdgpu_compute_multipipe = -1; > int amdgpu_gpu_recovery = -1; /* auto */ > -int amdgpu_emu_mode = 0; > -uint amdgpu_smu_memory_pool_size = 0; > +int amdgpu_emu_mode; > +uint amdgpu_smu_memory_pool_size; > /* FBC (bit 0) disabled by default*/ > -uint amdgpu_dc_feature_mask = 0; > -uint amdgpu_dc_debug_mask = 0; > +uint amdgpu_dc_feature_mask; > +uint amdgpu_dc_debug_mask; > int amdgpu_async_gfx_ring = 1; > -int amdgpu_mcbp = 0; > +int amdgpu_mcbp; > int amdgpu_discovery = -1; > -int amdgpu_mes = 0; > +int amdgpu_mes; > int amdgpu_noretry = -1; > int amdgpu_force_asic_type = -1; > -int amdgpu_tmz = 0; > +int amdgpu_tmz; > int amdgpu_reset_method = -1; /* auto */ > int amdgpu_num_kcq = -1; > > diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c > index 696e97ab77eb..46c00ee580b1 100644 > --- a/drivers/gpu/drm/amd/amdgpu/atom.c > +++ b/drivers/gpu/drm/amd/amdgpu/atom.c > @@ -66,7 +66,7 @@ typedef struct { > bool abort; > } atom_exec_context; > > -int amdgpu_atom_debug = 0; > +int amdgpu_atom_debug; > static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); > int amdgpu_atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); > > @@ -88,7 +88,7 @@ static int atom_dst_to_src[8][4] = { > }; > static int atom_def_dst[8] = { 0, 0, 1, 2, 0, 1, 2, 3 }; > > -static int debug_depth = 0; > +static int debug_depth; > #ifdef ATOM_DEBUG > static void debug_print_spaces(int n) > { > -- > 2.25.1 > > _______________________________________________ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx