Re: [PATCH 3/6] iio:dac:m62332: use ARRAY_SIZE

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

 



On Sat, Aug 29, 2015 at 12:59 AM, Hartmut Knaack <knaack.h@xxxxxx> wrote:
> Make use of ARRAY_SIZE to prevent buffer issues.
>
> Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>

Acked-by: Daniel Baluta <daniel.baluta@xxxxxxxxx>

> ---
>  drivers/iio/dac/m62332.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/dac/m62332.c b/drivers/iio/dac/m62332.c
> index c61720de8606..fe750982b502 100644
> --- a/drivers/iio/dac/m62332.c
> +++ b/drivers/iio/dac/m62332.c
> @@ -62,8 +62,8 @@ static int m62332_set_value(struct iio_dev *indio_dev,
>                         goto out;
>         }
>
> -       res = i2c_master_send(client, outbuf, 2);
> -       if (res >= 0 && res != 2)
> +       res = i2c_master_send(client, outbuf, ARRAY_SIZE(outbuf));
> +       if (res >= 0 && res != ARRAY_SIZE(outbuf))
>                 res = -EIO;
>         if (res < 0)
>                 goto out;
> @@ -212,7 +212,7 @@ static int m62332_probe(struct i2c_client *client,
>         /* establish that the iio_dev is a child of the i2c device */
>         indio_dev->dev.parent = &client->dev;
>
> -       indio_dev->num_channels = M62332_CHANNELS;
> +       indio_dev->num_channels = ARRAY_SIZE(m62332_channels);
>         indio_dev->channels = m62332_channels;
>         indio_dev->modes = INDIO_DIRECT_MODE;
>         indio_dev->info = &m62332_info;
> --
> 2.4.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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