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>
This commit is contained in:
parent
95273f8952
commit
64ebe955f9
4 changed files with 11 additions and 12 deletions
|
@ -306,10 +306,10 @@ static int __devinit hid_accel_3d_probe(struct platform_device *pdev)
|
||||||
goto error_free_dev;
|
goto error_free_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
channels = kmemdup(accel_3d_channels,
|
channels = kmemdup(accel_3d_channels, sizeof(accel_3d_channels),
|
||||||
sizeof(accel_3d_channels),
|
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!channels) {
|
if (!channels) {
|
||||||
|
ret = -ENOMEM;
|
||||||
dev_err(&pdev->dev, "failed to duplicate channels\n");
|
dev_err(&pdev->dev, "failed to duplicate channels\n");
|
||||||
goto error_free_dev;
|
goto error_free_dev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,10 +306,10 @@ static int __devinit hid_gyro_3d_probe(struct platform_device *pdev)
|
||||||
goto error_free_dev;
|
goto error_free_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
channels = kmemdup(gyro_3d_channels,
|
channels = kmemdup(gyro_3d_channels, sizeof(gyro_3d_channels),
|
||||||
sizeof(gyro_3d_channels),
|
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!channels) {
|
if (!channels) {
|
||||||
|
ret = -ENOMEM;
|
||||||
dev_err(&pdev->dev, "failed to duplicate channels\n");
|
dev_err(&pdev->dev, "failed to duplicate channels\n");
|
||||||
goto error_free_dev;
|
goto error_free_dev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,10 +272,9 @@ static int __devinit hid_als_probe(struct platform_device *pdev)
|
||||||
goto error_free_dev;
|
goto error_free_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
channels = kmemdup(als_channels,
|
channels = kmemdup(als_channels, sizeof(als_channels), GFP_KERNEL);
|
||||||
sizeof(als_channels),
|
|
||||||
GFP_KERNEL);
|
|
||||||
if (!channels) {
|
if (!channels) {
|
||||||
|
ret = -ENOMEM;
|
||||||
dev_err(&pdev->dev, "failed to duplicate channels\n");
|
dev_err(&pdev->dev, "failed to duplicate channels\n");
|
||||||
goto error_free_dev;
|
goto error_free_dev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,10 +307,10 @@ static int __devinit hid_magn_3d_probe(struct platform_device *pdev)
|
||||||
goto error_free_dev;
|
goto error_free_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
channels = kmemdup(magn_3d_channels,
|
channels = kmemdup(magn_3d_channels, sizeof(magn_3d_channels),
|
||||||
sizeof(magn_3d_channels),
|
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!channels) {
|
if (!channels) {
|
||||||
|
ret = -ENOMEM;
|
||||||
dev_err(&pdev->dev, "failed to duplicate channels\n");
|
dev_err(&pdev->dev, "failed to duplicate channels\n");
|
||||||
goto error_free_dev;
|
goto error_free_dev;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue