-----Original Message-----
From: Nikula, Jani <[email protected]> 
Sent: Wednesday, February 4, 2026 2:08 AM
To: Cavitt, Jonathan <[email protected]>; 
[email protected]
Cc: Gupta, Saurabhg <[email protected]>; Zuo, Alex <[email protected]>; 
Cavitt, Jonathan <[email protected]>
Subject: Re: [PATCH] drm/i915/gvt: No need for extra op check
> 
> On Tue, 03 Feb 2026, Jonathan Cavitt <[email protected]> wrote:
> > Static analysis issue:
> >
> > In intel_gvt_i2c_handle_aux_ch_write, we check if op & 0x1 == 0.  If it
> > does not equal zero, then it must equal one, so checking op & 0x1 == 1
> > in the case it does not equal zero is unnecessary.
> >
> > Signed-off-by: Jonathan Cavitt <[email protected]>
> > Cc: Jani Nikula <[email protected]>
> > ---
> >  drivers/gpu/drm/i915/gvt/edid.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/edid.c 
> > b/drivers/gpu/drm/i915/gvt/edid.c
> > index 021afff1cd5d..5ac7636d6c07 100644
> > --- a/drivers/gpu/drm/i915/gvt/edid.c
> > +++ b/drivers/gpu/drm/i915/gvt/edid.c
> > @@ -543,8 +543,6 @@ void intel_gvt_i2c_handle_aux_ch_write(struct 
> > intel_vgpu *vgpu,
> >              * support the gfx driver to do EDID access.
> >              */
> 
> The context here is
> 
>       } else if ((op & 0x1) == DP_AUX_I2C_WRITE) {
>               /* TODO
>                * We only support EDID reading from I2C_over_AUX. And
>                * we do not expect the index mode to be used. Right now
>                * the WRITE operation is ignored. It is good enough to
>                * support the gfx driver to do EDID access.
>                */
>       } else {
> 
> and you could also toss the empty branch to the curb and check for 
> 
>       } else if ((op & 0x1) == DP_AUX_I2C_READ) {

To clarify, you are asking me to reorder the if-else tree such that the first
else-if is triggered on DP_AUX_I2C_READ, and the else case is the blank
WRITE operation?
-Jonathan Cavitt

> 
> 
> 
> >     } else {
> > -           if (drm_WARN_ON(&i915->drm, (op & 0x1) != DP_AUX_I2C_READ))
> > -                   return;
> 
> 
> 
> >             if (drm_WARN_ON(&i915->drm, msg_length != 4))
> >                     return;
> >             if (i2c_edid->edid_available && i2c_edid->target_selected) {
> 
> -- 
> Jani Nikula, Intel
> 

Reply via email to