diff options
| -rw-r--r-- | drivers/iio/light/hid-sensor-prox.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c index 88f21bbe947c..36a2de35e525 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c | |||
| @@ -250,7 +250,6 @@ static int hid_prox_probe(struct platform_device *pdev) | |||
| 250 | struct iio_dev *indio_dev; | 250 | struct iio_dev *indio_dev; |
| 251 | struct prox_state *prox_state; | 251 | struct prox_state *prox_state; |
| 252 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; | 252 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
| 253 | struct iio_chan_spec *channels; | ||
| 254 | 253 | ||
| 255 | indio_dev = devm_iio_device_alloc(&pdev->dev, | 254 | indio_dev = devm_iio_device_alloc(&pdev->dev, |
| 256 | sizeof(struct prox_state)); | 255 | sizeof(struct prox_state)); |
| @@ -269,20 +268,21 @@ static int hid_prox_probe(struct platform_device *pdev) | |||
| 269 | return ret; | 268 | return ret; |
| 270 | } | 269 | } |
| 271 | 270 | ||
| 272 | channels = kmemdup(prox_channels, sizeof(prox_channels), GFP_KERNEL); | 271 | indio_dev->channels = kmemdup(prox_channels, sizeof(prox_channels), |
| 273 | if (!channels) { | 272 | GFP_KERNEL); |
| 273 | if (!indio_dev->channels) { | ||
| 274 | dev_err(&pdev->dev, "failed to duplicate channels\n"); | 274 | dev_err(&pdev->dev, "failed to duplicate channels\n"); |
| 275 | return -ENOMEM; | 275 | return -ENOMEM; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | ret = prox_parse_report(pdev, hsdev, channels, | 278 | ret = prox_parse_report(pdev, hsdev, |
| 279 | (struct iio_chan_spec *)indio_dev->channels, | ||
| 279 | HID_USAGE_SENSOR_PROX, prox_state); | 280 | HID_USAGE_SENSOR_PROX, prox_state); |
| 280 | if (ret) { | 281 | if (ret) { |
| 281 | dev_err(&pdev->dev, "failed to setup attributes\n"); | 282 | dev_err(&pdev->dev, "failed to setup attributes\n"); |
| 282 | goto error_free_dev_mem; | 283 | goto error_free_dev_mem; |
| 283 | } | 284 | } |
| 284 | 285 | ||
| 285 | indio_dev->channels = channels; | ||
| 286 | indio_dev->num_channels = | 286 | indio_dev->num_channels = |
| 287 | ARRAY_SIZE(prox_channels); | 287 | ARRAY_SIZE(prox_channels); |
| 288 | indio_dev->dev.parent = &pdev->dev; | 288 | indio_dev->dev.parent = &pdev->dev; |
