[PATCH 2/7] i2c: scx200_acb - debug log cleanup

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

 



Hi Jean,

On 12/19/05, Jean Delvare <khali at linux-fr.org> wrote:
> Hi Ben,
>
> > scx200_acb debug log cleanup.
>
> >       if (!len && rw == I2C_SMBUS_READ) {
> > -             dev_warn(&adapter->dev, "zero length read\n");
> > +             dev_dbg(&adapter->dev, "zero length read\n");
> >               return -EINVAL;
> >       }
>
> It just happened to me that this test is bogus. len == 0 && rw ==
> I2C_SMBUS_READ is perfectly valid according to the SMBus specification.
> It's a "quick command" with data (1 bit) == 1. I never saw it used in
> practice, and everyone seems to agree that this is a weirdness in SMBus'
> specification (using the read/write bit as data in this specific case)
> but it's still valid.

It looks like the case for state_quick won't work for 0-len reads.
It should unconditionally jump to state_write for a 0-len state_quick operation.
I'll write up a separate patch to fix that and remove the check tomorrow.

> >       if (len && !buffer) {
> > -             dev_warn(&adapter->dev, "nonzero length but no buffer\n");
> > +             dev_dbg(&adapter->dev, "nonzero length but no buffer\n");
> >               return -EFAULT;
> >       }
>
> I think that the whole block should be enclosed by #ifdef DEBUG/#endif,
> as this error condition is simply not supposed to happen.

I assume other drivers don't check for this... why not just delete it?

Thanks,
Ben




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux