[PATCH] staging iio: Replace kmalloc with local variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: anish kumar <anish198519851985@xxxxxxxxx>

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@xxxxxxxxx>
---
 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


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux