linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: Deepak R Varma <mh12gx2825@gmail.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"amd-gfx list" <amd-gfx@lists.freedesktop.org>,
	"Maling list - DRI developers" <dri-devel@lists.freedesktop.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Melissa Wen" <melissa.srw@gmail.com>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drm/amdgpu: do not initialise global variables to 0 or NULL
Date: Mon, 2 Nov 2020 14:43:45 -0500	[thread overview]
Message-ID: <CADnq5_OnA3T_p4pTEOpoqQ=NZyso2VFoDiOHu=+h7dKOeKHq-A@mail.gmail.com> (raw)
In-Reply-To: <20201102184147.GA42288@localhost>

On Mon, Nov 2, 2020 at 1:42 PM Deepak R Varma <mh12gx2825@gmail.com> 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 <mh12gx2825@gmail.com>
> ---
>  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

  reply	other threads:[~2020-11-02 19:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 18:41 [PATCH] drm/amdgpu: do not initialise global variables to 0 or NULL Deepak R Varma
2020-11-02 19:43 ` Alex Deucher [this message]
2020-11-02 20:06   ` Christian König
2020-11-03  6:53     ` Greg KH
2020-11-02 20:48       ` Christian König
2020-11-03  7:53         ` Greg KH
2020-11-03  8:23           ` Christian König
2020-11-03 14:50       ` Deucher, Alexander
2020-11-03 15:34         ` Greg KH
2020-11-02 20:10   ` Greg KH
2020-11-02 22:30     ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADnq5_OnA3T_p4pTEOpoqQ=NZyso2VFoDiOHu=+h7dKOeKHq-A@mail.gmail.com' \
    --to=alexdeucher@gmail.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=melissa.srw@gmail.com \
    --cc=mh12gx2825@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).