Re: [PATCH 1/2] drm/i915/perf: Initialise err to 0 before looping over ce->engines

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

 



Quoting Lionel Landwerlin (2019-07-26 14:00:07)
> On 26/07/2019 15:54, Chris Wilson wrote:
> > Smatch warning that the loop may be empty causing us to check err before
> > it had been set. Ensure that it is initialised to 0, just in case.
> >
> > Fixes: a9877da2d629 ("drm/i915/oa: Reconfigure contexts on the fly")
> > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Cc: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> > ---
> >   drivers/gpu/drm/i915/i915_perf.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> > index 79be9d8ea628..a294c0f53625 100644
> > --- a/drivers/gpu/drm/i915/i915_perf.c
> > +++ b/drivers/gpu/drm/i915/i915_perf.c
> > @@ -1875,6 +1875,7 @@ static int gen8_configure_all_contexts(struct drm_i915_private *i915,
> >               if (ctx == i915->kernel_context)
> >                       continue;
> >   
> > +             err = 0;
> >               for_each_gem_engine(ce,
> >                                   i915_gem_context_lock_engines(ctx),
> >                                   it) {
> Could almost reduce the scope of variable. Regardless :

Yeah, I was tempted. The second loop is a bit uglier with int err, so
left it for later. This loop would look better if we pulled the inner
out into its function.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux