aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHartmut Knaack <knaack.h@gmx.de>2015-08-28 17:59:55 -0400
committerJonathan Cameron <jic23@kernel.org>2015-10-11 10:42:41 -0400
commit7d2da8eaa92585769dfbafe285b94c8f743510f6 (patch)
treeb9fb5cac3567b9356ca005f0a8d4bd81f75cedc6
parent847e3928de0998883219d7052cf4c049c21966e9 (diff)
iio:dac:m62332: use ARRAY_SIZE
Make use of ARRAY_SIZE to prevent buffer issues. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/dac/m62332.c6
1 files 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,
62 goto out; 62 goto out;
63 } 63 }
64 64
65 res = i2c_master_send(client, outbuf, 2); 65 res = i2c_master_send(client, outbuf, ARRAY_SIZE(outbuf));
66 if (res >= 0 && res != 2) 66 if (res >= 0 && res != ARRAY_SIZE(outbuf))
67 res = -EIO; 67 res = -EIO;
68 if (res < 0) 68 if (res < 0)
69 goto out; 69 goto out;
@@ -212,7 +212,7 @@ static int m62332_probe(struct i2c_client *client,
212 /* establish that the iio_dev is a child of the i2c device */ 212 /* establish that the iio_dev is a child of the i2c device */
213 indio_dev->dev.parent = &client->dev; 213 indio_dev->dev.parent = &client->dev;
214 214
215 indio_dev->num_channels = M62332_CHANNELS; 215 indio_dev->num_channels = ARRAY_SIZE(m62332_channels);
216 indio_dev->channels = m62332_channels; 216 indio_dev->channels = m62332_channels;
217 indio_dev->modes = INDIO_DIRECT_MODE; 217 indio_dev->modes = INDIO_DIRECT_MODE;
218 indio_dev->info = &m62332_info; 218 indio_dev->info = &m62332_info;