All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/amdgpu: soc15 enable (v3)
@ 2017-04-03 18:53 Dan Carpenter
  2017-04-03 19:12 ` Alex Deucher
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-04-03 18:53 UTC (permalink / raw)
  To: Qingqing.Wang-5C7GfCeVMHo; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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?

   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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bug report] drm/amdgpu: soc15 enable (v3)
  2017-04-03 18:53 [bug report] drm/amdgpu: soc15 enable (v3) Dan Carpenter
@ 2017-04-03 19:12 ` Alex Deucher
       [not found]   ` <CADnq5_OUXQUFG7kvg_FuLd+Pz0wy9q3gFEe68cm6C7ozpbaZzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2017-04-03 19:12 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Ken Wang, amd-gfx list

On Mon, Apr 3, 2017 at 2:53 PM, Dan Carpenter <dan.carpenter@oracle.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bug report] drm/amdgpu: soc15 enable (v3)
       [not found]   ` <CADnq5_OUXQUFG7kvg_FuLd+Pz0wy9q3gFEe68cm6C7ozpbaZzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-04-03 19:29     ` Dan Carpenter
  2017-04-03 19:35       ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-04-03 19:29 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Ken Wang, amd-gfx list

On Mon, Apr 03, 2017 at 03:12:31PM -0400, Alex Deucher wrote:
> On Mon, Apr 3, 2017 at 2:53 PM, Dan Carpenter <dan.carpenter@oracle.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bug report] drm/amdgpu: soc15 enable (v3)
  2017-04-03 19:29     ` Dan Carpenter
@ 2017-04-03 19:35       ` Dan Carpenter
  2017-04-03 19:54         ` Deucher, Alexander
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2017-04-03 19:35 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Ken Wang, amd-gfx list

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [bug report] drm/amdgpu: soc15 enable (v3)
  2017-04-03 19:35       ` Dan Carpenter
@ 2017-04-03 19:54         ` Deucher, Alexander
  0 siblings, 0 replies; 5+ messages in thread
From: Deucher, Alexander @ 2017-04-03 19:54 UTC (permalink / raw)
  To: 'Dan Carpenter', Alex Deucher; +Cc: Wang, Ken, amd-gfx list

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-03 19:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-03 18:53 [bug report] drm/amdgpu: soc15 enable (v3) Dan Carpenter
2017-04-03 19:12 ` Alex Deucher
     [not found]   ` <CADnq5_OUXQUFG7kvg_FuLd+Pz0wy9q3gFEe68cm6C7ozpbaZzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-03 19:29     ` Dan Carpenter
2017-04-03 19:35       ` Dan Carpenter
2017-04-03 19:54         ` Deucher, Alexander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.