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 c4b1813..39cdc09 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -264,7 +264,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 = {
@@ -274,9 +274,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;
@@ -305,8 +302,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.1


------------------------------------------------------------------------------
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to