From: Axel Lin <axel.lin@ingics.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: srinivas pandruvada <srinivas.pandruvada@intel.com>,
Lars-Peter Clausen <lars@metafoo.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] iio: hid-sensor: Return proper error if kmemdup fails
Date: Sat, 27 Oct 2012 23:03:30 +0800 [thread overview]
Message-ID: <1351350210.10004.3.camel@phoenix> (raw)
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
next reply other threads:[~2012-10-27 15:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-27 15:03 Axel Lin [this message]
2012-11-02 10:05 ` [PATCH] iio: hid-sensor: Return proper error if kmemdup fails Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351350210.10004.3.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=jic23@cam.ac.uk \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.pandruvada@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.