Skip to contentSkip to conversation

hso: fix disable_net

PATCH Superseded Filip Aben 3 participants 4 messages Nov 24, 2010 – Nov 25, 2010

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Filip Aben

author
#0 lore raw

PATCH 1/1 hso: fix disable_net

The HSO driver incorrectly creates a serial device instead of a net device when disable_net is set. It shouldn't create anything for the network interface.

---

drivers/net/usb/hso.c +3 -3
index b154a94..b05c235 100644
@@ -2994,10 +2994,10 @@ static int hso_probe(struct usb_interface *interface,
 
 	case HSO_INTF_BULK:
 		/* It's a regular bulk interface */
-		if (((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) &&
-		    !disable_net)
+		if ((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) { 
+		    if(!disable_net)
 			hso_dev = hso_create_net_device(interface, port_spec);
-		else
+		} else
 			hso_dev =
 			    hso_create_bulk_serial_device(interface, port_spec);
 		if (!hso_dev)

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

Hello.

Quoted 12 lines · Filip Aben

The HSO driver incorrectly creates a serial device instead of a net device when disable_net is set. It shouldn't create anything for the network interface.

---

drivers/net/usb/hso.c +0 -0
index b154a94..b05c235 100644

drivers/net/usb/hso.c static int hso_probe(struct usb_interface *interface, · line 2998

Quoted 7 lines
drivers/net/usb/hso.c +2 -2
@@ -2994,10 +2994,10 @@ static int hso_probe(struct usb_interface *interface,
 
  	case HSO_INTF_BULK:
  		/* It's a regular bulk interface */
-		if (((port_spec&  HSO_PORT_MASK) == HSO_PORT_NETWORK)&&
-		    !disable_net)
+		if ((port_spec&  HSO_PORT_MASK) == HSO_PORT_NETWORK) {
+		    if(!disable_net)

Don't use spaces for indentation.

WBR, Sergei

#2 lore raw
In reply to Filip Aben
Quoted 12 lines · Filip Aben

The HSO driver incorrectly creates a serial device instead of a net device when disable_net is set. It shouldn't create anything for the network interface.

---

drivers/net/usb/hso.c +0 -0
index b154a94..b05c235 100644

drivers/net/usb/hso.c static int hso_probe(struct usb_interface *interface, · line 3000

Quoted 10 lines
drivers/net/usb/hso.c +3 -3
@@ -2994,10 +2994,10 @@ static int hso_probe(struct usb_interface *interface,
 
  	case HSO_INTF_BULK:
  		/* It's a regular bulk interface */
-		if (((port_spec&  HSO_PORT_MASK) == HSO_PORT_NETWORK)&&
-		    !disable_net)
+		if ((port_spec&  HSO_PORT_MASK) == HSO_PORT_NETWORK) {
+		    if(!disable_net)
  			hso_dev = hso_create_net_device(interface, port_spec);
-		else
+		} else

There should now be {} on the *else* branch too, according to CodingStyle.

drivers/net/usb/hso.c static int hso_probe(struct usb_interface *interface, · line 3003

Quoted 3 lines
drivers/net/usb/hso.c +0 -0
  			hso_dev =
  			    hso_create_bulk_serial_device(interface, port_spec);
  		if (!hso_dev)

WBR, Sergei

#3 lore raw
In reply to Filip Aben
Quoted 3 lines · Filip Aben

The HSO driver incorrectly creates a serial device instead of a net device when disable_net is set. It shouldn't create anything for the network interface.

Looks good apart from the indentation issue pointed out by Sergei (you should also
indent the hso_create_net_device line).

As I mentioned in another thread, this was actually suggested about a year ago but was never accepted due to patch corruption (the other two patches submitted as part of that series also seem to have been plain wrong, though):

	http://kerneltrap.org/mailarchive/linux-netdev/2009/11/19/6261572

Thanks,
Johan