netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phonet: Add error handling in phonet_device_init
@ 2023-09-23 11:58 liuhaoran
  2023-09-23 14:37 ` kernel test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: liuhaoran @ 2023-09-23 11:58 UTC (permalink / raw)
  To: davem; +Cc: edumazet, kuba, pabeni, netdev, liuhaoran

This patch adds error-handling for the proc_create_net() and
register_netdevice_notifier() inside the phonet_device_init.

Signed-off-by: liuhaoran <liuhaoran14@163.com>
---
 net/phonet/pn_dev.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index cde671d29d5d..c974b64d52b9 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -336,10 +336,19 @@ int __init phonet_device_init(void)
 	if (err)
 		return err;
 
-	proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
-			sizeof(struct seq_net_private));
-	register_netdevice_notifier(&phonet_device_notifier);
+	err = proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
+			      sizeof(struct seq_net_private));
+
+	if (!err)
+		return err;
+
+	err = register_netdevice_notifier(&phonet_device_notifier);
+
+	if (!err)
+		return err;
+
 	err = phonet_netlink_register();
+
 	if (err)
 		phonet_device_exit();
 	return err;
-- 
2.17.1


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

* Re: [PATCH] net: phonet: Add error handling in phonet_device_init
  2023-09-23 11:58 [PATCH] net: phonet: Add error handling in phonet_device_init liuhaoran
@ 2023-09-23 14:37 ` kernel test robot
  2023-09-23 17:08 ` Andrew Lunn
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-09-23 14:37 UTC (permalink / raw)
  To: liuhaoran, davem; +Cc: oe-kbuild-all, edumazet, kuba, pabeni, netdev, liuhaoran

Hi liuhaoran,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master horms-ipvs/master v6.6-rc2 next-20230921]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/liuhaoran/net-phonet-Add-error-handling-in-phonet_device_init/20230923-200141
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230923115847.32740-1-liuhaoran14%40163.com
patch subject: [PATCH] net: phonet: Add error handling in phonet_device_init
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20230923/202309232243.cyUNs2XY-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230923/202309232243.cyUNs2XY-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309232243.cyUNs2XY-lkp@intel.com/

All warnings (new ones prefixed by >>):

   net/phonet/pn_dev.c: In function 'phonet_device_init':
>> net/phonet/pn_dev.c:339:13: warning: assignment to 'int' from 'struct proc_dir_entry *' makes integer from pointer without a cast [-Wint-conversion]
     339 |         err = proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
         |             ^


vim +339 net/phonet/pn_dev.c

   331	
   332	/* Initialize Phonet devices list */
   333	int __init phonet_device_init(void)
   334	{
   335		int err = register_pernet_subsys(&phonet_net_ops);
   336		if (err)
   337			return err;
   338	
 > 339		err = proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
   340				      sizeof(struct seq_net_private));
   341	
   342		if (!err)
   343			return err;
   344	
   345		err = register_netdevice_notifier(&phonet_device_notifier);
   346	
   347		if (!err)
   348			return err;
   349	
   350		err = phonet_netlink_register();
   351	
   352		if (err)
   353			phonet_device_exit();
   354		return err;
   355	}
   356	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] net: phonet: Add error handling in phonet_device_init
  2023-09-23 11:58 [PATCH] net: phonet: Add error handling in phonet_device_init liuhaoran
  2023-09-23 14:37 ` kernel test robot
@ 2023-09-23 17:08 ` Andrew Lunn
  2023-09-24  6:21 ` kernel test robot
  2023-09-25 15:58 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2023-09-23 17:08 UTC (permalink / raw)
  To: liuhaoran; +Cc: davem, edumazet, kuba, pabeni, netdev

On Sat, Sep 23, 2023 at 07:58:47PM +0800, liuhaoran wrote:
> This patch adds error-handling for the proc_create_net() and
> register_netdevice_notifier() inside the phonet_device_init.
> 
> Signed-off-by: liuhaoran <liuhaoran14@163.com>
> ---
>  net/phonet/pn_dev.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
> index cde671d29d5d..c974b64d52b9 100644
> --- a/net/phonet/pn_dev.c
> +++ b/net/phonet/pn_dev.c
> @@ -336,10 +336,19 @@ int __init phonet_device_init(void)
>  	if (err)
>  		return err;
>  
> -	proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
> -			sizeof(struct seq_net_private));
> -	register_netdevice_notifier(&phonet_device_notifier);
> +	err = proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
> +			      sizeof(struct seq_net_private));
> +
> +	if (!err)
> +		return err;

As the build bot has shown, you should at least compile test your
changes.

> +
> +	err = register_netdevice_notifier(&phonet_device_notifier);
> +
> +	if (!err)
> +		return err;
> +

If this fails, you should clean up proc.

	Andrew

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

* Re: [PATCH] net: phonet: Add error handling in phonet_device_init
  2023-09-23 11:58 [PATCH] net: phonet: Add error handling in phonet_device_init liuhaoran
  2023-09-23 14:37 ` kernel test robot
  2023-09-23 17:08 ` Andrew Lunn
@ 2023-09-24  6:21 ` kernel test robot
  2023-09-25 15:58 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-09-24  6:21 UTC (permalink / raw)
  To: liuhaoran, davem; +Cc: oe-kbuild-all, edumazet, kuba, pabeni, netdev, liuhaoran

Hi liuhaoran,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master horms-ipvs/master v6.6-rc2 next-20230921]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/liuhaoran/net-phonet-Add-error-handling-in-phonet_device_init/20230923-200141
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230923115847.32740-1-liuhaoran14%40163.com
patch subject: [PATCH] net: phonet: Add error handling in phonet_device_init
config: powerpc64-randconfig-003-20230924 (https://download.01.org/0day-ci/archive/20230924/202309241414.qIf54B9l-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230924/202309241414.qIf54B9l-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309241414.qIf54B9l-lkp@intel.com/

All warnings (new ones prefixed by >>):

   net/phonet/pn_dev.c: In function 'phonet_device_init':
>> net/phonet/pn_dev.c:339:13: warning: assignment to 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
     339 |         err = proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
         |             ^


vim +339 net/phonet/pn_dev.c

   331	
   332	/* Initialize Phonet devices list */
   333	int __init phonet_device_init(void)
   334	{
   335		int err = register_pernet_subsys(&phonet_net_ops);
   336		if (err)
   337			return err;
   338	
 > 339		err = proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
   340				      sizeof(struct seq_net_private));
   341	
   342		if (!err)
   343			return err;
   344	
   345		err = register_netdevice_notifier(&phonet_device_notifier);
   346	
   347		if (!err)
   348			return err;
   349	
   350		err = phonet_netlink_register();
   351	
   352		if (err)
   353			phonet_device_exit();
   354		return err;
   355	}
   356	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] net: phonet: Add error handling in phonet_device_init
  2023-09-23 11:58 [PATCH] net: phonet: Add error handling in phonet_device_init liuhaoran
                   ` (2 preceding siblings ...)
  2023-09-24  6:21 ` kernel test robot
@ 2023-09-25 15:58 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-09-25 15:58 UTC (permalink / raw)
  To: liuhaoran, davem; +Cc: oe-kbuild-all, edumazet, kuba, pabeni, netdev, liuhaoran

Hi liuhaoran,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master horms-ipvs/master v6.6-rc3 next-20230925]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/liuhaoran/net-phonet-Add-error-handling-in-phonet_device_init/20230923-200141
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230923115847.32740-1-liuhaoran14%40163.com
patch subject: [PATCH] net: phonet: Add error handling in phonet_device_init
config: x86_64-randconfig-123-20230925 (https://download.01.org/0day-ci/archive/20230925/202309252347.ef6inFEC-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230925/202309252347.ef6inFEC-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309252347.ef6inFEC-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> net/phonet/pn_dev.c:339:13: sparse: sparse: incorrect type in assignment (different base types) @@     expected int err @@     got struct proc_dir_entry * @@
   net/phonet/pn_dev.c:339:13: sparse:     expected int err
   net/phonet/pn_dev.c:339:13: sparse:     got struct proc_dir_entry *

vim +339 net/phonet/pn_dev.c

   331	
   332	/* Initialize Phonet devices list */
   333	int __init phonet_device_init(void)
   334	{
   335		int err = register_pernet_subsys(&phonet_net_ops);
   336		if (err)
   337			return err;
   338	
 > 339		err = proc_create_net("pnresource", 0, init_net.proc_net, &pn_res_seq_ops,
   340				      sizeof(struct seq_net_private));
   341	
   342		if (!err)
   343			return err;
   344	
   345		err = register_netdevice_notifier(&phonet_device_notifier);
   346	
   347		if (!err)
   348			return err;
   349	
   350		err = phonet_netlink_register();
   351	
   352		if (err)
   353			phonet_device_exit();
   354		return err;
   355	}
   356	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2023-09-25 15:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-23 11:58 [PATCH] net: phonet: Add error handling in phonet_device_init liuhaoran
2023-09-23 14:37 ` kernel test robot
2023-09-23 17:08 ` Andrew Lunn
2023-09-24  6:21 ` kernel test robot
2023-09-25 15:58 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).