Re: [PATCH v2 2/2] iio: accel: Add driver for Murata SCA3300 accelerometer

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

 



On Mon, Apr 19, 2021 at 1:29 PM Tomas Melin <tomas.melin@xxxxxxxxxxx> wrote:
> On 4/17/21 3:39 PM, Andy Shevchenko wrote:
> > On Fri, Apr 16, 2021 at 5:21 PM Tomas Melin <tomas.melin@xxxxxxxxxxx> wrote:
> >> Add initial support for Murata SCA3300 3-axis industrial
> >> accelerometer with digital SPI interface. This device also
> >> provides a temperature measurement.

...

> >> +       ret = spi_sync_transfer(sca_data->spi, xfers, ARRAY_SIZE(xfers));
> >> +       if (ret < 0) {
> >> +               dev_err(&sca_data->spi->dev,
> >> +                       "transfer error, error: %d\n", ret);
> >> +               return -EIO;
> > Why shadowing error code?
>
> Returning EIO here to have full control over the return value from this
> function. As return value of this is used for testing

Care to show what kind of testing requires this?
Also why can't it be refactored to accept all error codes?

> for possible status error (EINVAL), feels more confident to have it like
> this to avoid any confusion. And atleast spi_sync_transfer() return value
>
> would be visible in error message.

> >> +       }



-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux