mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rtl8712: add a check for the status of register_netdev
@ 2018-12-26  1:30 Kangjie Lu
  2018-12-26  2:29 ` kbuild test robot
  2018-12-26  2:31 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Kangjie Lu @ 2018-12-26  1:30 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Larry Finger, Florian Schilhabel, Greg Kroah-Hartman,
	André Lehmann, devel, linux-kernel

register_netdev() may fail, so let's check its return value, and if it
fails, issue an error message.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/staging/rtl8712/hal_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 7cdd609cab6c..7e2f8e0185d5 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -45,7 +45,8 @@ static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
 	}
 	padapter->fw = firmware;
 	/* firmware available - start netdev */
-	register_netdev(padapter->pnetdev);
+	if (register_netdev(padapter->pnetdev))
+		dev_err(&udev->dev, "r8712u: Registering netdev failed\n");
 }
 
 static const char firmware_file[] = "rtlwifi/rtl8712u.bin";
-- 
2.17.2 (Apple Git-113)


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

* Re: [PATCH] rtl8712: add a check for the status of register_netdev
  2018-12-26  1:30 [PATCH] rtl8712: add a check for the status of register_netdev Kangjie Lu
@ 2018-12-26  2:29 ` kbuild test robot
  2018-12-26  2:31 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-12-26  2:29 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: kbuild-all, kjlu, pakki001, Larry Finger, Florian Schilhabel,
	Greg Kroah-Hartman, André Lehmann, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3038 bytes --]

Hi Kangjie,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.20 next-20181224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Kangjie-Lu/rtl8712-add-a-check-for-the-status-of-register_netdev/20181226-094828
config: nds32-allmodconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=6.4.0 make.cross ARCH=nds32 

All errors (new ones prefixed by >>):

   In file included from include/linux/usb/ch9.h:36:0,
                    from include/linux/usb.h:6,
                    from drivers/staging//rtl8712/hal_init.c:19:
   drivers/staging//rtl8712/hal_init.c: In function 'rtl871x_load_fw_cb':
>> drivers/staging//rtl8712/hal_init.c:49:12: error: 'udev' undeclared (first use in this function)
      dev_err(&udev->dev, "r8712u: Registering netdev failed\n");
               ^
   include/linux/device.h:1453:11: note: in definition of macro 'dev_err'
     _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
              ^~~
   drivers/staging//rtl8712/hal_init.c:49:12: note: each undeclared identifier is reported only once for each function it appears in
      dev_err(&udev->dev, "r8712u: Registering netdev failed\n");
               ^
   include/linux/device.h:1453:11: note: in definition of macro 'dev_err'
     _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
              ^~~

vim +/udev +49 drivers/staging//rtl8712/hal_init.c

    18	
  > 19	#include <linux/usb.h>
    20	#include <linux/device.h>
    21	#include <linux/usb/ch9.h>
    22	#include <linux/firmware.h>
    23	#include <linux/module.h>
    24	
    25	#include "osdep_service.h"
    26	#include "drv_types.h"
    27	#include "usb_osintf.h"
    28	
    29	#define FWBUFF_ALIGN_SZ 512
    30	#define MAX_DUMP_FWSZ	49152 /*default = 49152 (48k)*/
    31	
    32	static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
    33	{
    34		struct _adapter *padapter = context;
    35	
    36		complete(&padapter->rtl8712_fw_ready);
    37		if (!firmware) {
    38			struct usb_device *udev = padapter->dvobjpriv.pusbdev;
    39			struct usb_interface *pusb_intf = padapter->pusb_intf;
    40	
    41			dev_err(&udev->dev, "r8712u: Firmware request failed\n");
    42			usb_put_dev(udev);
    43			usb_set_intfdata(pusb_intf, NULL);
    44			return;
    45		}
    46		padapter->fw = firmware;
    47		/* firmware available - start netdev */
    48		if (register_netdev(padapter->pnetdev))
  > 49			dev_err(&udev->dev, "r8712u: Registering netdev failed\n");
    50	}
    51	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48542 bytes --]

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

* Re: [PATCH] rtl8712: add a check for the status of register_netdev
  2018-12-26  1:30 [PATCH] rtl8712: add a check for the status of register_netdev Kangjie Lu
  2018-12-26  2:29 ` kbuild test robot
@ 2018-12-26  2:31 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-12-26  2:31 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: kbuild-all, kjlu, pakki001, Larry Finger, Florian Schilhabel,
	Greg Kroah-Hartman, André Lehmann, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3053 bytes --]

Hi Kangjie,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.20 next-20181224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Kangjie-Lu/rtl8712-add-a-check-for-the-status-of-register_netdev/20181226-094828
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   In file included from include/linux/usb/ch9.h:36,
                    from include/linux/usb.h:6,
                    from drivers/staging/rtl8712/hal_init.c:19:
   drivers/staging/rtl8712/hal_init.c: In function 'rtl871x_load_fw_cb':
>> drivers/staging/rtl8712/hal_init.c:49:12: error: 'udev' undeclared (first use in this function); did you mean 'cdev'?
      dev_err(&udev->dev, "r8712u: Registering netdev failed\n");
               ^~~~
   include/linux/device.h:1453:11: note: in definition of macro 'dev_err'
     _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
              ^~~
   drivers/staging/rtl8712/hal_init.c:49:12: note: each undeclared identifier is reported only once for each function it appears in
      dev_err(&udev->dev, "r8712u: Registering netdev failed\n");
               ^~~~
   include/linux/device.h:1453:11: note: in definition of macro 'dev_err'
     _dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
              ^~~

vim +49 drivers/staging/rtl8712/hal_init.c

    18	
  > 19	#include <linux/usb.h>
    20	#include <linux/device.h>
    21	#include <linux/usb/ch9.h>
    22	#include <linux/firmware.h>
    23	#include <linux/module.h>
    24	
    25	#include "osdep_service.h"
    26	#include "drv_types.h"
    27	#include "usb_osintf.h"
    28	
    29	#define FWBUFF_ALIGN_SZ 512
    30	#define MAX_DUMP_FWSZ	49152 /*default = 49152 (48k)*/
    31	
    32	static void rtl871x_load_fw_cb(const struct firmware *firmware, void *context)
    33	{
    34		struct _adapter *padapter = context;
    35	
    36		complete(&padapter->rtl8712_fw_ready);
    37		if (!firmware) {
    38			struct usb_device *udev = padapter->dvobjpriv.pusbdev;
    39			struct usb_interface *pusb_intf = padapter->pusb_intf;
    40	
    41			dev_err(&udev->dev, "r8712u: Firmware request failed\n");
    42			usb_put_dev(udev);
    43			usb_set_intfdata(pusb_intf, NULL);
    44			return;
    45		}
    46		padapter->fw = firmware;
    47		/* firmware available - start netdev */
    48		if (register_netdev(padapter->pnetdev))
  > 49			dev_err(&udev->dev, "r8712u: Registering netdev failed\n");
    50	}
    51	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55702 bytes --]

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

end of thread, other threads:[~2018-12-26  2:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26  1:30 [PATCH] rtl8712: add a check for the status of register_netdev Kangjie Lu
2018-12-26  2:29 ` kbuild test robot
2018-12-26  2:31 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®