rsi: use macro for allocating USB buffer
authorAmitkumar Karwar <amit.karwar@redpinesignals.com>
Tue, 11 Jul 2017 14:27:51 +0000 (19:57 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 28 Jul 2017 14:27:18 +0000 (17:27 +0300)
4 bytes is fixed size for reading or writing USB register. We
will use a macro instead of hardcoding this.

Fixes: b97e9b94ad75c ("rsi: Add new host interface operations")
Signed-off-by: Amitkumar Karwar <amit.karwar@redpinesignals.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_usb.c
drivers/net/wireless/rsi/rsi_usb.h

index 3febf24..99a520a 100644 (file)
@@ -162,7 +162,7 @@ static int rsi_usb_reg_read(struct usb_device *usbdev,
        u8 *buf;
        int status = -ENOMEM;
 
-       buf  = kmalloc(0x04, GFP_KERNEL);
+       buf  = kmalloc(RSI_USB_CTRL_BUF_SIZE, GFP_KERNEL);
        if (!buf)
                return status;
 
@@ -204,7 +204,7 @@ static int rsi_usb_reg_write(struct usb_device *usbdev,
        u8 *usb_reg_buf;
        int status = -ENOMEM;
 
-       usb_reg_buf  = kmalloc(0x04, GFP_KERNEL);
+       usb_reg_buf  = kmalloc(RSI_USB_CTRL_BUF_SIZE, GFP_KERNEL);
        if (!usb_reg_buf)
                return status;
 
index 3babf81..891daea 100644 (file)
@@ -37,6 +37,7 @@
 #define BT_EP                        2
 
 #define RSI_USB_BUF_SIZE            4096
+#define RSI_USB_CTRL_BUF_SIZE       0x04
 
 struct rsi_91x_usbdev {
        struct rsi_thread rx_thread;