Re: [PATCH] drm/i915: Silence compiler for csr_load_work_fn()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Michal Wajdeczko (2017-11-07 17:48:14)
> On Tue, 07 Nov 2017 15:53:34 +0100, Chris Wilson  
> <chris@xxxxxxxxxxxxxxxxxx> wrote:
> 
> > gcc-4.7 is not very smart and can not tell that "si" is guarded by size
> > being 0. So it complains,
> >
> > drivers/gpu/drm/i915/intel_csr.c: In function ‘csr_load_work_fn’:
> > drivers/gpu/drm/i915/intel_csr.c:204:3: warning: ‘si’ may be used  
> > uninitialized in this function [-Wmaybe-uninitialized]
> > drivers/gpu/drm/i915/intel_csr.c:190:30: note: ‘si’ was declared in
> >
> > Give in and mark si as NULL.
> >
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Cc: Anusha Srivatsa <anusha.srivatsa@xxxxxxxxx>
> > Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
> > Cc: Imre Deak <imre.deak@xxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/intel_csr.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_csr.c  
> > b/drivers/gpu/drm/i915/intel_csr.c
> > index 3e1f86d0c6cc..77d8b3d483ca 100644
> > --- a/drivers/gpu/drm/i915/intel_csr.c
> > +++ b/drivers/gpu/drm/i915/intel_csr.c
> > @@ -198,6 +198,7 @@ intel_get_stepping_info(struct drm_i915_private  
> > *dev_priv)
> >               si = bxt_stepping_info;
> >       } else {
> >               size = 0;
> > +             si = NULL;
> >       }
> >       if (INTEL_REVID(dev_priv) < size)
> 
> Not only gcc was complaning here, smatch report was similar:
> 
> drivers/gpu/drm/i915/intel_csr.c:204
>   intel_get_stepping_info() error: uninitialized symbol 'si'
> 
> and marking si as NULL silence that error too, so:
> 
> Reviewed-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx>
> 
> But at the same time I'm wondering if is it ok that we silently
> convert higher SKL/BXT revisions into wildcard ... but this is
> another story.

Yup. I guess a MISSING_CASE() warn might be appropriate, or some other
recognisable error message. Hmm, I wonder how much we would save if they
were only enable for CI.

Anyway, thanks for the review. Pushed, but I expect a patch from you
shortly ;)
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux