Re: [PATCH] drm/i915: Avoid divide by zero

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

 



On Tue, 2019-01-22 at 15:07 +0200, Jani Nikula wrote:
> On Tue, 22 Jan 2019, Mika Kahola <mika.kahola@xxxxxxxxx> wrote:
> > Avoid divide by zero warning on static analysis.
> > 
> > Signed-off-by: Mika Kahola <mika.kahola@xxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c
> > b/drivers/gpu/drm/i915/intel_pm.c
> > index 8b63afa3a221..6a8e8b3f44c2 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -3912,8 +3912,10 @@ skl_ddb_get_pipe_allocation_limits(struct
> > drm_i915_private *dev_priv,
> >  			pipe_width = hdisplay;
> >  	}
> 
> if (WARN_ON(total_width == 0))
> 	return;
Warning might be enough here. Switching to use this in this patch.

Thanks for the review!

Cheers,
Mika

> 
> ?
> 
> BR,
> Jani.
> 
> 
> >  
> > -	alloc->start = ddb_size * width_before_pipe / total_width;
> > -	alloc->end = ddb_size * (width_before_pipe + pipe_width) /
> > total_width;
> > +	alloc->start = total_width == 0 ?
> > +		0 : ddb_size * width_before_pipe / total_width;
> > +	alloc->end = total_width == 0 ?
> > +		0 : ddb_size * (width_before_pipe + pipe_width) /
> > total_width;
> >  }
> >  
> >  static unsigned int skl_cursor_allocation(int num_active)
> 
> 
_______________________________________________
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