[2/2] snap: handle registration error and compile warning

Submitted by stephen hemminger on Feb. 20, 2009, 6:03 p.m.

Details

Message ID 20090220100302.561dcfab@extreme
State Accepted
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger Feb. 20, 2009, 6:03 p.m.
If this module can't load, it is almost certainly because something else
is already bound to that SAP. So in that case, return the same error code
as other SAP usage, and fail the module load.

Also fixes a compiler warning about printk of non const.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Arnaldo Carvalho de Melo Feb. 20, 2009, 9:37 p.m.
Em Fri, Feb 20, 2009 at 10:03:02AM -0800, Stephen Hemminger escreveu:
> If this module can't load, it is almost certainly because something else
> is already bound to that SAP. So in that case, return the same error code
> as other SAP usage, and fail the module load.
> 
> Also fixes a compiler warning about printk of non const.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Thanks,


Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 
> 
> --- a/net/802/psnap.c	2009-02-20 08:38:04.545372306 -0800
> +++ b/net/802/psnap.c	2009-02-20 08:39:16.394961522 -0800
> @@ -95,15 +95,16 @@ static int snap_request(struct datalink_
>  EXPORT_SYMBOL(register_snap_client);
>  EXPORT_SYMBOL(unregister_snap_client);
>  
> -static char snap_err_msg[] __initdata =
> +static const char snap_err_msg[] __initconst =
>  	KERN_CRIT "SNAP - unable to register with 802.2\n";
>  
>  static int __init snap_init(void)
>  {
>  	snap_sap = llc_sap_open(0xAA, snap_rcv);
> -
> -	if (!snap_sap)
> +	if (!snap_sap) {
>  		printk(snap_err_msg);
> +		return -EBUSY;
> +	}
>  
>  	return 0;
>  }
> --
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Feb. 22, 2009, 8:03 a.m.
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Fri, 20 Feb 2009 18:37:35 -0300

> Em Fri, Feb 20, 2009 at 10:03:02AM -0800, Stephen Hemminger escreveu:
> > If this module can't load, it is almost certainly because something else
> > is already bound to that SAP. So in that case, return the same error code
> > as other SAP usage, and fail the module load.
> > 
> > Also fixes a compiler warning about printk of non const.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> Thanks,
> 
> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Also applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch hide | download patch | download mbox

--- a/net/802/psnap.c	2009-02-20 08:38:04.545372306 -0800
+++ b/net/802/psnap.c	2009-02-20 08:39:16.394961522 -0800
@@ -95,15 +95,16 @@  static int snap_request(struct datalink_
 EXPORT_SYMBOL(register_snap_client);
 EXPORT_SYMBOL(unregister_snap_client);
 
-static char snap_err_msg[] __initdata =
+static const char snap_err_msg[] __initconst =
 	KERN_CRIT "SNAP - unable to register with 802.2\n";
 
 static int __init snap_init(void)
 {
 	snap_sap = llc_sap_open(0xAA, snap_rcv);
-
-	if (!snap_sap)
+	if (!snap_sap) {
 		printk(snap_err_msg);
+		return -EBUSY;
+	}
 
 	return 0;
 }