Commit 5ba5b437 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jonathan Cameron

iio: adc: ti_am335x_adc: allocating too much in probe

We should be allocating enough information for a tiadc_device struct
which is about 400 bytes but instead we allocate enough for a second
iio_dev struct which is over 2000 bytes.

Fixes: fea89e2d ("iio: adc: ti_am335x_adc: use variable names for sizeof() operator")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent f35327f1
...@@ -614,7 +614,7 @@ static int tiadc_probe(struct platform_device *pdev) ...@@ -614,7 +614,7 @@ static int tiadc_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*indio_dev)); indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev));
if (indio_dev == NULL) { if (indio_dev == NULL) {
dev_err(&pdev->dev, "failed to allocate iio device\n"); dev_err(&pdev->dev, "failed to allocate iio device\n");
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment