Re: [PATCH v5 3/3] drivers: iio: adc: add support for ad777x family

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

 



> ...
> 
> > +       iio_device_claim_direct_scoped(return -EBUSY, indio_dev) {
> > +               switch (mask) {
> > +               case IIO_CHAN_INFO_CALIBSCALE:
> > +                       *val = ad7779_get_calibscale(st, chan->channel);
> > +                       if (*val < 0)
> > +                               return -EINVAL;
> > +                       *val2 = GAIN_REL;
> > +                       return IIO_VAL_FRACTIONAL;
> > +               case IIO_CHAN_INFO_CALIBBIAS:
> > +                       *val = ad7779_get_calibbias(st, chan->channel);
> > +                       if (*val < 0)
> > +                               return -EINVAL;
> > +                       return IIO_VAL_INT;
> > +               case IIO_CHAN_INFO_SAMP_FREQ:
> > +                       *val = st->sampling_freq;
> > +                       if (*val < 0)
> > +                               return -EINVAL;
> > +                       return IIO_VAL_INT;
> > +               }
> > +               return -EINVAL;
> > +       }  
> 
> > +       unreachable();  
> 
> Hmm... Is it necessary? Same Q for other similar cases. I.o.w. what
> will be if we don't add this line?

The compiler can't tell that the contents of iio_device_claim_direct_scoped()
always runs.  Hence normal result is it complains that nothing was returned.

Why the compiler can't figure out?  Who knows... 

Jonathan




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux