diff options
author | Axel Lin <axel.lin@ingics.com> | 2012-10-27 11:03:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-11-17 05:17:28 -0500 |
commit | 64ebe955f9447fcecf65360ec3bc332f4ec411b6 (patch) | |
tree | 73ef17a2dd1c4f6958facd12b2516c55342f454a /drivers/iio/magnetometer/hid-sensor-magn-3d.c | |
parent | 95273f8952a7e3a037e139eec0aa99872f086498 (diff) |
iio: hid-sensor: Return proper error if kmemdup fails
Return -ENOMEM instead of 0 if kmemdup fails.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/magnetometer/hid-sensor-magn-3d.c')
-rw-r--r-- | drivers/iio/magnetometer/hid-sensor-magn-3d.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c index d1b5fb74b9bf..8e75eb76ccd9 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c | |||
@@ -307,10 +307,10 @@ static int __devinit hid_magn_3d_probe(struct platform_device *pdev) | |||
307 | goto error_free_dev; | 307 | goto error_free_dev; |
308 | } | 308 | } |
309 | 309 | ||
310 | channels = kmemdup(magn_3d_channels, | 310 | channels = kmemdup(magn_3d_channels, sizeof(magn_3d_channels), |
311 | sizeof(magn_3d_channels), | 311 | GFP_KERNEL); |
312 | GFP_KERNEL); | ||
313 | if (!channels) { | 312 | if (!channels) { |
313 | ret = -ENOMEM; | ||
314 | dev_err(&pdev->dev, "failed to duplicate channels\n"); | 314 | dev_err(&pdev->dev, "failed to duplicate channels\n"); |
315 | goto error_free_dev; | 315 | goto error_free_dev; |
316 | } | 316 | } |