This patch puts a buffer on the stack instead of heap. There is no need
to hold the buffer on the heap.

Signed-off-by: Alexander Aring <alex.ar...@gmail.com>
---
 drivers/net/ieee802154/at86rf230.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 994c334..d1fca56 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -261,7 +261,7 @@ __at86rf230_detect_device(struct spi_device *spi, u16 
*man_id, u8 *part,
                u8 *version)
 {
        u8 data[4];
-       u8 *buf = kmalloc(2, GFP_KERNEL);
+       u8 buf[2];
        int status;
        struct spi_message msg;
        struct spi_transfer xfer = {
@@ -271,9 +271,6 @@ __at86rf230_detect_device(struct spi_device *spi, u16 
*man_id, u8 *part,
        };
        u8 reg;
 
-       if (!buf)
-               return -ENOMEM;
-
        for (reg = RG_PART_NUM; reg <= RG_MAN_ID_1; reg++) {
                buf[0] = (reg & CMD_REG_MASK) | CMD_REG;
                buf[1] = 0xff;
@@ -302,8 +299,6 @@ __at86rf230_detect_device(struct spi_device *spi, u16 
*man_id, u8 *part,
                *man_id = (data[3] << 8) | data[2];
        }
 
-       kfree(buf);
-
        return status;
 }
 
-- 
1.9.2


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to