All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging iio: Replace kmalloc with local variable
@ 2011-06-07 12:39 anish
  2011-06-07 13:00   ` Jonathan Cameron
  0 siblings, 1 reply; 25+ messages in thread
From: anish @ 2011-06-07 12:39 UTC (permalink / raw)
  To: gregkh, jic23, manuel.stahl, lucas.demarchi
  Cc: devel, linux-kernel, linux-iio

From: anish kumar <anish198519851985@gmail.com>

replaced kmalloc with local variable as I2C(in this case) doesn't require
kmalloc memory it can do with stack memory.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
---
 drivers/staging/iio/adc/max1363_core.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index 1037087..9462230 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -207,15 +207,12 @@ 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;
 	tx_buf[0] = d1;
 	tx_buf[1] = d2;
 
 	ret = i2c_master_send(client, tx_buf, 2);
-	kfree(tx_buf);
 
 	return (ret > 0) ? 0 : ret;
 }
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2011-06-09 15:03 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-07 12:39 [PATCH] staging iio: Replace kmalloc with local variable anish
2011-06-07 13:00 ` Jonathan Cameron
2011-06-07 13:00   ` Jonathan Cameron
     [not found]   ` <4DEE20E7.4020008-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2011-06-07 13:41     ` Ben Dooks
2011-06-07 13:41       ` Ben Dooks
     [not found]       ` <20110607134135.GD15795-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2011-06-07 13:54         ` Jonathan Cameron
2011-06-07 13:54           ` Jonathan Cameron
     [not found]           ` <4DEE2D7D.6070506-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2011-06-07 14:04             ` Hennerich, Michael
2011-06-07 14:04               ` Hennerich, Michael
2011-06-07 14:04               ` Hennerich, Michael
2011-06-07 14:02         ` Jean Delvare
2011-06-07 14:02           ` Jean Delvare
2011-06-08  5:11           ` anish singh
2011-06-09  8:23             ` anish singh
     [not found]               ` <BANLkTi=e0A2G-d+t4VF5V0gj+eNoh3KRnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-09  8:29                 ` Jean Delvare
2011-06-09  8:29                   ` Jean Delvare
2011-06-09  8:34                   ` anish singh
     [not found]                     ` <BANLkTimq_5rmB+UkaxZwrOtV-ZF3+fEOgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-09  8:48                       ` Jonathan Cameron
2011-06-09  8:48                         ` Jonathan Cameron
     [not found]                         ` <4DF088E5.5000408-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2011-06-09 10:46                           ` Jonathan Cameron
2011-06-09 10:46                             ` Jonathan Cameron
2011-06-09 14:29                             ` anish singh
     [not found]                               ` <BANLkTik4Tfd73iKcDsXK-sfy6_ADVX4oYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-06-09 14:51                                 ` Jonathan Cameron
2011-06-09 14:51                                   ` Jonathan Cameron
2011-06-09 15:03                                   ` anish singh

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.