Re: [bug report] drm/amdgpu: soc15 enable (v3)

2017-04-03 Thread Alex Deucher
On Mon, Apr 3, 2017 at 2:53 PM, Dan Carpenter  wrote:
> Hello Ken Wang,
>
> The patch 220ab9bd1ccf: "drm/amdgpu: soc15 enable (v3)" from Mar 6,
> 2017, leads to the following static checker warning:
>
> drivers/gpu/drm/amd/amdgpu/soc15.c:110 soc15_pcie_rreg()
> error: potentially dereferencing uninitialized 'nbio_pcie_id'.
>
> drivers/gpu/drm/amd/amdgpu/soc15.c
>101  static u32 soc15_pcie_rreg(struct amdgpu_device *adev, u32 reg)
>102  {
>103  unsigned long flags, address, data;
>104  u32 r;
>105  struct nbio_pcie_index_data *nbio_pcie_id;
>106
>107  if (adev->asic_type == CHIP_VEGA10)
>108  nbio_pcie_id = &nbio_v6_1_pcie_index_data;
>
> There should be an else statement to this probably?

Currently vega10 is the only soc15 gpu so there is else case yet.

Alex

>
>109
>110  address = nbio_pcie_id->index_offset;
>111  data = nbio_pcie_id->data_offset;
>112
>113  spin_lock_irqsave(&adev->pcie_idx_lock, flags);
>114  WREG32(address, reg);
>115  (void)RREG32(address);
>116  r = RREG32(data);
>117  spin_unlock_irqrestore(&adev->pcie_idx_lock, flags);
>118  return r;
>119  }
>120
>
> See also:
>
> drivers/gpu/drm/amd/amdgpu/soc15.c:110 soc15_pcie_rreg() error: potentially 
> dereferencing uninitialized 'nbio_pcie_id'.
> drivers/gpu/drm/amd/amdgpu/soc15.c:129 soc15_pcie_wreg() error: potentially 
> dereferencing uninitialized 'nbio_pcie_id'.
> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1736 amdgpu_sriov_reinit_early() 
> error: uninitialized symbol 'r'.
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:3033 gfx_v9_0_ring_emit_hdp_flush() 
> error:  potentially dereferencing uninitialized 'nbio_hf_reg'.
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:3036 gfx_v9_0_ring_emit_hdp_flush() 
> error: potentially dereferencing uninitialized 'nbio_hf_reg'.
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:3043 gfx_v9_0_ring_emit_hdp_flush() 
> error: potentially dereferencing uninitialized 'nbio_hf_reg'.
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:357 sdma_v4_0_ring_emit_hdp_flush() 
> error: potentially dereferencing uninitialized 'nbio_hf_reg'.
> drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c:359 sdma_v4_0_ring_emit_hdp_flush() 
> error: potentially dereferencing uninitialized 'nbio_hf_reg'.
> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vega10_smumgr.c:425 
> vega10_smu_init() error: uninitialized symbol 'handle'.
> drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/vega10_hwmgr.c:2860 
> vega10_apply_state_adjust_rules() error: uninitialized symbol 
> 'stable_pstate_sclk_dpm_percentage'.
>
> regards,
> dan carpenter
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [bug report] drm/amdgpu: soc15 enable (v3)

2017-04-03 Thread Dan Carpenter
On Mon, Apr 03, 2017 at 03:12:31PM -0400, Alex Deucher wrote:
> On Mon, Apr 3, 2017 at 2:53 PM, Dan Carpenter  
> wrote:
> > Hello Ken Wang,
> >
> > The patch 220ab9bd1ccf: "drm/amdgpu: soc15 enable (v3)" from Mar 6,
> > 2017, leads to the following static checker warning:
> >
> > drivers/gpu/drm/amd/amdgpu/soc15.c:110 soc15_pcie_rreg()
> > error: potentially dereferencing uninitialized 'nbio_pcie_id'.
> >
> > drivers/gpu/drm/amd/amdgpu/soc15.c
> >101  static u32 soc15_pcie_rreg(struct amdgpu_device *adev, u32 reg)
> >102  {
> >103  unsigned long flags, address, data;
> >104  u32 r;
> >105  struct nbio_pcie_index_data *nbio_pcie_id;
> >106
> >107  if (adev->asic_type == CHIP_VEGA10)
> >108  nbio_pcie_id = &nbio_v6_1_pcie_index_data;
> >
> > There should be an else statement to this probably?
> 
> Currently vega10 is the only soc15 gpu so there is else case yet.
> 

Yeah.  I figured.  But it's annoying to have half implemented code and
static checker warnings.

regards,
dan carpenter

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


Re: [bug report] drm/amdgpu: soc15 enable (v3)

2017-04-03 Thread Dan Carpenter
If we added an:

else
BUG();

that would silence the warning.


regards,
dan carpenter
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


RE: [bug report] drm/amdgpu: soc15 enable (v3)

2017-04-03 Thread Deucher, Alexander
> -Original Message-
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf
> Of Dan Carpenter
> Sent: Monday, April 03, 2017 3:35 PM
> To: Alex Deucher
> Cc: Wang, Ken; amd-gfx list
> Subject: Re: [bug report] drm/amdgpu: soc15 enable (v3)
> 
> If we added an:
> 
>   else
>   BUG();
> 
> that would silence the warning.


We can do that.

Alex

> 
> 
> regards,
> dan carpenter
> ___
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx