* [PATCH] iio: hid-sensor: Return proper error if kmemdup fails
@ 2012-10-27 15:03 Axel Lin
2012-11-02 10:05 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-10-27 15:03 UTC (permalink / raw)
To: Jonathan Cameron
Cc: srinivas pandruvada, Lars-Peter Clausen, linux-iio, linux-kernel
Return -ENOMEM instead of 0 if kmemdup fails.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/iio/accel/hid-sensor-accel-3d.c | 6 +++---
drivers/iio/gyro/hid-sensor-gyro-3d.c | 6 +++---
drivers/iio/light/hid-sensor-als.c | 5 ++---
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 6 +++---
4 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index 1b49931..2046208 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -319,10 +319,10 @@ static int __devinit hid_accel_3d_probe(struct platform_device *pdev)
goto error_free_dev;
}
- channels = kmemdup(accel_3d_channels,
- sizeof(accel_3d_channels),
- GFP_KERNEL);
+ channels = kmemdup(accel_3d_channels, sizeof(accel_3d_channels),
+ GFP_KERNEL);
if (!channels) {
+ ret = -ENOMEM;
dev_err(&pdev->dev, "failed to duplicate channels\n");
goto error_free_dev;
}
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index 705dc49..c93dd59 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -319,10 +319,10 @@ static int __devinit hid_gyro_3d_probe(struct platform_device *pdev)
goto error_free_dev;
}
- channels = kmemdup(gyro_3d_channels,
- sizeof(gyro_3d_channels),
- GFP_KERNEL);
+ channels = kmemdup(gyro_3d_channels, sizeof(gyro_3d_channels),
+ GFP_KERNEL);
if (!channels) {
+ ret = -ENOMEM;
dev_err(&pdev->dev, "failed to duplicate channels\n");
goto error_free_dev;
}
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 4c35ac7..ea59daa 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -285,10 +285,9 @@ static int __devinit hid_als_probe(struct platform_device *pdev)
goto error_free_dev;
}
- channels = kmemdup(als_channels,
- sizeof(als_channels),
- GFP_KERNEL);
+ channels = kmemdup(als_channels, sizeof(als_channels), GFP_KERNEL);
if (!channels) {
+ ret = -ENOMEM;
dev_err(&pdev->dev, "failed to duplicate channels\n");
goto error_free_dev;
}
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index a02dc98..63d0a38 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -320,10 +320,10 @@ static int __devinit hid_magn_3d_probe(struct platform_device *pdev)
goto error_free_dev;
}
- channels = kmemdup(magn_3d_channels,
- sizeof(magn_3d_channels),
- GFP_KERNEL);
+ channels = kmemdup(magn_3d_channels, sizeof(magn_3d_channels),
+ GFP_KERNEL);
if (!channels) {
+ ret = -ENOMEM;
dev_err(&pdev->dev, "failed to duplicate channels\n");
goto error_free_dev;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: hid-sensor: Return proper error if kmemdup fails
2012-10-27 15:03 [PATCH] iio: hid-sensor: Return proper error if kmemdup fails Axel Lin
@ 2012-11-02 10:05 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2012-11-02 10:05 UTC (permalink / raw)
To: Axel Lin
Cc: Jonathan Cameron, srinivas pandruvada, Lars-Peter Clausen,
linux-iio, linux-kernel
On 10/27/2012 04:03 PM, Axel Lin wrote:
> Return -ENOMEM instead of 0 if kmemdup fails.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Added to fixes-togreg branch of iio.git
Thanks
> ---
> drivers/iio/accel/hid-sensor-accel-3d.c | 6 +++---
> drivers/iio/gyro/hid-sensor-gyro-3d.c | 6 +++---
> drivers/iio/light/hid-sensor-als.c | 5 ++---
> drivers/iio/magnetometer/hid-sensor-magn-3d.c | 6 +++---
> 4 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
> index 1b49931..2046208 100644
> --- a/drivers/iio/accel/hid-sensor-accel-3d.c
> +++ b/drivers/iio/accel/hid-sensor-accel-3d.c
> @@ -319,10 +319,10 @@ static int __devinit hid_accel_3d_probe(struct platform_device *pdev)
> goto error_free_dev;
> }
>
> - channels = kmemdup(accel_3d_channels,
> - sizeof(accel_3d_channels),
> - GFP_KERNEL);
> + channels = kmemdup(accel_3d_channels, sizeof(accel_3d_channels),
> + GFP_KERNEL);
> if (!channels) {
> + ret = -ENOMEM;
> dev_err(&pdev->dev, "failed to duplicate channels\n");
> goto error_free_dev;
> }
> diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
> index 705dc49..c93dd59 100644
> --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
> +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
> @@ -319,10 +319,10 @@ static int __devinit hid_gyro_3d_probe(struct platform_device *pdev)
> goto error_free_dev;
> }
>
> - channels = kmemdup(gyro_3d_channels,
> - sizeof(gyro_3d_channels),
> - GFP_KERNEL);
> + channels = kmemdup(gyro_3d_channels, sizeof(gyro_3d_channels),
> + GFP_KERNEL);
> if (!channels) {
> + ret = -ENOMEM;
> dev_err(&pdev->dev, "failed to duplicate channels\n");
> goto error_free_dev;
> }
> diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
> index 4c35ac7..ea59daa 100644
> --- a/drivers/iio/light/hid-sensor-als.c
> +++ b/drivers/iio/light/hid-sensor-als.c
> @@ -285,10 +285,9 @@ static int __devinit hid_als_probe(struct platform_device *pdev)
> goto error_free_dev;
> }
>
> - channels = kmemdup(als_channels,
> - sizeof(als_channels),
> - GFP_KERNEL);
> + channels = kmemdup(als_channels, sizeof(als_channels), GFP_KERNEL);
> if (!channels) {
> + ret = -ENOMEM;
> dev_err(&pdev->dev, "failed to duplicate channels\n");
> goto error_free_dev;
> }
> diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> index a02dc98..63d0a38 100644
> --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> @@ -320,10 +320,10 @@ static int __devinit hid_magn_3d_probe(struct platform_device *pdev)
> goto error_free_dev;
> }
>
> - channels = kmemdup(magn_3d_channels,
> - sizeof(magn_3d_channels),
> - GFP_KERNEL);
> + channels = kmemdup(magn_3d_channels, sizeof(magn_3d_channels),
> + GFP_KERNEL);
> if (!channels) {
> + ret = -ENOMEM;
> dev_err(&pdev->dev, "failed to duplicate channels\n");
> goto error_free_dev;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-02 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-27 15:03 [PATCH] iio: hid-sensor: Return proper error if kmemdup fails Axel Lin
2012-11-02 10:05 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).