Re: [PATCH] staging: vc04_services: vchiq_arm: Fix initialisation check

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

 



Quoting Dan Carpenter (2024-06-13 20:58:40)
> On Thu, Jun 13, 2024 at 08:41:45PM +0100, Kieran Bingham wrote:
> > ---
> >  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c  | 4 ++--
> >  .../staging/vc04_services/interface/vchiq_arm/vchiq_core.h | 5 +++++
> >  .../staging/vc04_services/interface/vchiq_arm/vchiq_dev.c  | 7 ++++++-
> >  3 files changed, 13 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> > index 54467be8c371..67d853f5f2a0 100644
> > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> > @@ -804,7 +804,7 @@ int vchiq_initialise(struct vchiq_state *state, struct vchiq_instance **instance
> >        * block forever.
> >        */
> >       for (i = 0; i < VCHIQ_INIT_RETRIES; i++) {
> > -             if (state)
> > +             if (vchiq_remote_initialised(state))
> >                       break;
> >               usleep_range(500, 600);
> >       }
> 
> :/  In the original code, this would either break on the first iteration
> or fail.  The diff looked like this:
> 
>         for (i = 0; i < VCHIQ_INIT_RETRIES; i++) {
> -               state = vchiq_get_state();
>                 if (state)
>                         break;
> 
> I feel bad for not spotting this.  A static checker which looked at

Definitely don't feel bad - I'm pretty sure I looked through the patch
on it's way through too and missed it then!

I only spotted this once I went deeper and was doing more rework, so it
suddenly stood out with more context.

Unfortunately - it's one of the pains of limited context in diffs in a
mail client I think.

--
Kieran


> diffs could have made this work, but all of our tools look at a momement
> in time instead of looking at the change over time.
> 
> regards,
> dan carpenter
>





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux