From: anish <anish198519851985@gmail.com>
To: gregkh@suse.de, jic23@cam.ac.uk, manuel.stahl@iis.fraunhofer.de,
lucas.demarchi@profusion.mobi, arnd@arndb.de
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] staging: iio replaced kmalloc with local variables.
Date: Tue, 07 Jun 2011 00:37:37 +0530 [thread overview]
Message-ID: <1307387257.4327.12.camel@anish-desktop> (raw)
From: anish kumar <anish198519851985@gmail.com>
Replace kmalloc with local variables as it was un-necessary and
also removed the redudant code after this change.
Signed-off-by: anish kumar <anish198519851985@gmail.com>
---
drivers/staging/iio/accel/kxsd9.c | 19 +++----------------
drivers/staging/iio/adc/max1363_core.c | 3 +--
2 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/iio/accel/kxsd9.c b/drivers/staging/iio/accel/kxsd9.c
index 431aa0f..7f6e6e5 100644
--- a/drivers/staging/iio/accel/kxsd9.c
+++ b/drivers/staging/iio/accel/kxsd9.c
@@ -255,7 +255,10 @@ static const struct attribute_group kxsd9_attribute_group = {
static int __devinit kxsd9_power_up(struct spi_device *spi)
{
+ struct spi_message msg;
int ret;
+ u8 tx[2], tx2[2];
+
struct spi_transfer xfers[2] = {
{
.bits_per_word = 8,
@@ -267,19 +270,7 @@ static int __devinit kxsd9_power_up(struct spi_device *spi)
.cs_change = 1,
},
};
- struct spi_message msg;
- u8 *tx2;
- u8 *tx = kmalloc(2, GFP_KERNEL);
- if (tx == NULL) {
- ret = -ENOMEM;
- goto error_ret;
- }
- tx2 = kmalloc(2, GFP_KERNEL);
- if (tx2 == NULL) {
- ret = -ENOMEM;
- goto error_free_tx;
- }
tx[0] = 0x0d;
tx[1] = 0x40;
@@ -293,10 +284,6 @@ static int __devinit kxsd9_power_up(struct spi_device *spi)
spi_message_add_tail(&xfers[1], &msg);
ret = spi_sync(spi, &msg);
- kfree(tx2);
-error_free_tx:
- kfree(tx);
-error_ret:
return ret;
};
diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index 1037087..0026242 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -207,7 +207,7 @@ static int max1363_write_basic_config(struct i2c_client *client,
unsigned char d2)
{
int ret;
- u8 *tx_buf = kmalloc(2, GFP_KERNEL);
+ u8 tx_buf[2];
if (!tx_buf)
return -ENOMEM;
@@ -215,7 +215,6 @@ static int max1363_write_basic_config(struct i2c_client *client,
tx_buf[1] = d2;
ret = i2c_master_send(client, tx_buf, 2);
- kfree(tx_buf);
return (ret > 0) ? 0 : ret;
}
--
1.7.0.4
next reply other threads:[~2011-06-06 19:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 19:07 anish [this message]
2011-06-06 19:13 ` [PATCH 1/2] staging: iio replaced kmalloc with local variables Geert Uytterhoeven
2011-06-06 19:49 ` Dan Carpenter
2011-06-06 19:20 ` Peter Hüwe
2011-06-06 21:55 ` Greg KH
2011-06-06 22:10 ` Joe Perches
2011-06-06 22:21 ` Greg KH
2011-06-06 22:28 ` Joe Perches
2011-06-06 22:41 ` Greg KH
2011-06-06 22:49 ` Joe Perches
[not found] ` <BANLkTimZP1=tOdsn9eNiERr0Up0xHrr=3g@mail.gmail.com>
2011-06-07 9:43 ` Jonathan Cameron
2011-06-07 10:32 ` anish kumar
2011-06-07 11:23 ` Jonathan Cameron
2011-06-07 9:35 ` 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=1307387257.4327.12.camel@anish-desktop \
--to=anish198519851985@gmail.com \
--cc=arnd@arndb.de \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=jic23@cam.ac.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@profusion.mobi \
--cc=manuel.stahl@iis.fraunhofer.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox