diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 34 | ||||
-rw-r--r-- | drivers/net/irda/irda-usb.c | 24 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_fr.c | 3 |
3 files changed, 24 insertions, 37 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 070b78d959cc..1afda3230def 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1202,43 +1202,35 @@ static int bond_sethwaddr(struct net_device *bond_dev, | |||
1202 | return 0; | 1202 | return 0; |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | #define BOND_INTERSECT_FEATURES \ | 1205 | #define BOND_VLAN_FEATURES \ |
1206 | (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO) | 1206 | (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \ |
1207 | NETIF_F_HW_VLAN_FILTER) | ||
1207 | 1208 | ||
1208 | /* | 1209 | /* |
1209 | * Compute the common dev->feature set available to all slaves. Some | 1210 | * Compute the common dev->feature set available to all slaves. Some |
1210 | * feature bits are managed elsewhere, so preserve feature bits set on | 1211 | * feature bits are managed elsewhere, so preserve those feature bits |
1211 | * master device that are not part of the examined set. | 1212 | * on the master device. |
1212 | */ | 1213 | */ |
1213 | static int bond_compute_features(struct bonding *bond) | 1214 | static int bond_compute_features(struct bonding *bond) |
1214 | { | 1215 | { |
1215 | unsigned long features = BOND_INTERSECT_FEATURES; | ||
1216 | struct slave *slave; | 1216 | struct slave *slave; |
1217 | struct net_device *bond_dev = bond->dev; | 1217 | struct net_device *bond_dev = bond->dev; |
1218 | unsigned long features = bond_dev->features; | ||
1218 | unsigned short max_hard_header_len = ETH_HLEN; | 1219 | unsigned short max_hard_header_len = ETH_HLEN; |
1219 | int i; | 1220 | int i; |
1220 | 1221 | ||
1222 | features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES); | ||
1223 | features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | | ||
1224 | NETIF_F_GSO_MASK | NETIF_F_NO_CSUM; | ||
1225 | |||
1221 | bond_for_each_slave(bond, slave, i) { | 1226 | bond_for_each_slave(bond, slave, i) { |
1222 | features &= (slave->dev->features & BOND_INTERSECT_FEATURES); | 1227 | features = netdev_compute_features(features, |
1228 | slave->dev->features); | ||
1223 | if (slave->dev->hard_header_len > max_hard_header_len) | 1229 | if (slave->dev->hard_header_len > max_hard_header_len) |
1224 | max_hard_header_len = slave->dev->hard_header_len; | 1230 | max_hard_header_len = slave->dev->hard_header_len; |
1225 | } | 1231 | } |
1226 | 1232 | ||
1227 | if ((features & NETIF_F_SG) && | 1233 | features |= (bond_dev->features & BOND_VLAN_FEATURES); |
1228 | !(features & NETIF_F_ALL_CSUM)) | ||
1229 | features &= ~NETIF_F_SG; | ||
1230 | |||
1231 | /* | ||
1232 | * features will include NETIF_F_TSO (NETIF_F_UFO) iff all | ||
1233 | * slave devices support NETIF_F_TSO (NETIF_F_UFO), which | ||
1234 | * implies that all slaves also support scatter-gather | ||
1235 | * (NETIF_F_SG), which implies that features also includes | ||
1236 | * NETIF_F_SG. So no need to check whether we have an | ||
1237 | * illegal combination of NETIF_F_{TSO,UFO} and | ||
1238 | * !NETIF_F_SG | ||
1239 | */ | ||
1240 | |||
1241 | features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES); | ||
1242 | bond_dev->features = features; | 1234 | bond_dev->features = features; |
1243 | bond_dev->hard_header_len = max_hard_header_len; | 1235 | bond_dev->hard_header_len = max_hard_header_len; |
1244 | 1236 | ||
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 0ac240ca905b..3b0fd83fa266 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1561,10 +1561,9 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf | |||
1561 | struct irda_class_desc *desc; | 1561 | struct irda_class_desc *desc; |
1562 | int ret; | 1562 | int ret; |
1563 | 1563 | ||
1564 | desc = kmalloc(sizeof (*desc), GFP_KERNEL); | 1564 | desc = kzalloc(sizeof(*desc), GFP_KERNEL); |
1565 | if (desc == NULL) | 1565 | if (!desc) |
1566 | return NULL; | 1566 | return NULL; |
1567 | memset(desc, 0, sizeof(*desc)); | ||
1568 | 1567 | ||
1569 | /* USB-IrDA class spec 1.0: | 1568 | /* USB-IrDA class spec 1.0: |
1570 | * 6.1.3: Standard "Get Descriptor" Device Request is not | 1569 | * 6.1.3: Standard "Get Descriptor" Device Request is not |
@@ -1617,7 +1616,7 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1617 | { | 1616 | { |
1618 | struct net_device *net; | 1617 | struct net_device *net; |
1619 | struct usb_device *dev = interface_to_usbdev(intf); | 1618 | struct usb_device *dev = interface_to_usbdev(intf); |
1620 | struct irda_usb_cb *self = NULL; | 1619 | struct irda_usb_cb *self; |
1621 | struct usb_host_interface *interface; | 1620 | struct usb_host_interface *interface; |
1622 | struct irda_class_desc *irda_desc; | 1621 | struct irda_class_desc *irda_desc; |
1623 | int ret = -ENOMEM; | 1622 | int ret = -ENOMEM; |
@@ -1655,7 +1654,7 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1655 | self->header_length = USB_IRDA_HEADER; | 1654 | self->header_length = USB_IRDA_HEADER; |
1656 | } | 1655 | } |
1657 | 1656 | ||
1658 | self->rx_urb = kzalloc(self->max_rx_urb * sizeof(struct urb *), | 1657 | self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *), |
1659 | GFP_KERNEL); | 1658 | GFP_KERNEL); |
1660 | 1659 | ||
1661 | for (i = 0; i < self->max_rx_urb; i++) { | 1660 | for (i = 0; i < self->max_rx_urb; i++) { |
@@ -1715,7 +1714,7 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1715 | /* Find IrDA class descriptor */ | 1714 | /* Find IrDA class descriptor */ |
1716 | irda_desc = irda_usb_find_class_desc(intf); | 1715 | irda_desc = irda_usb_find_class_desc(intf); |
1717 | ret = -ENODEV; | 1716 | ret = -ENODEV; |
1718 | if (irda_desc == NULL) | 1717 | if (!irda_desc) |
1719 | goto err_out_3; | 1718 | goto err_out_3; |
1720 | 1719 | ||
1721 | if (self->needspatch) { | 1720 | if (self->needspatch) { |
@@ -1738,15 +1737,13 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1738 | /* Don't change this buffer size and allocation without doing | 1737 | /* Don't change this buffer size and allocation without doing |
1739 | * some heavy and complete testing. Don't ask why :-( | 1738 | * some heavy and complete testing. Don't ask why :-( |
1740 | * Jean II */ | 1739 | * Jean II */ |
1741 | self->speed_buff = kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); | 1740 | self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); |
1742 | if (self->speed_buff == NULL) | 1741 | if (!self->speed_buff) |
1743 | goto err_out_3; | 1742 | goto err_out_3; |
1744 | 1743 | ||
1745 | memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU); | ||
1746 | |||
1747 | self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, | 1744 | self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, |
1748 | GFP_KERNEL); | 1745 | GFP_KERNEL); |
1749 | if (self->tx_buff == NULL) | 1746 | if (!self->tx_buff) |
1750 | goto err_out_4; | 1747 | goto err_out_4; |
1751 | 1748 | ||
1752 | ret = irda_usb_open(self); | 1749 | ret = irda_usb_open(self); |
@@ -1767,12 +1764,11 @@ static int irda_usb_probe(struct usb_interface *intf, | |||
1767 | 1764 | ||
1768 | /* replace IrDA class descriptor with what patched device is now reporting */ | 1765 | /* replace IrDA class descriptor with what patched device is now reporting */ |
1769 | irda_desc = irda_usb_find_class_desc (self->usbintf); | 1766 | irda_desc = irda_usb_find_class_desc (self->usbintf); |
1770 | if (irda_desc == NULL) { | 1767 | if (!irda_desc) { |
1771 | ret = -ENODEV; | 1768 | ret = -ENODEV; |
1772 | goto err_out_6; | 1769 | goto err_out_6; |
1773 | } | 1770 | } |
1774 | if (self->irda_desc) | 1771 | kfree(self->irda_desc); |
1775 | kfree (self->irda_desc); | ||
1776 | self->irda_desc = irda_desc; | 1772 | self->irda_desc = irda_desc; |
1777 | irda_usb_init_qos(self); | 1773 | irda_usb_init_qos(self); |
1778 | } | 1774 | } |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 15b6e07a4382..071a64cacd5c 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -212,14 +212,13 @@ static pvc_device* add_pvc(struct net_device *dev, u16 dlci) | |||
212 | pvc_p = &(*pvc_p)->next; | 212 | pvc_p = &(*pvc_p)->next; |
213 | } | 213 | } |
214 | 214 | ||
215 | pvc = kmalloc(sizeof(pvc_device), GFP_ATOMIC); | 215 | pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC); |
216 | #ifdef DEBUG_PVC | 216 | #ifdef DEBUG_PVC |
217 | printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); | 217 | printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev); |
218 | #endif | 218 | #endif |
219 | if (!pvc) | 219 | if (!pvc) |
220 | return NULL; | 220 | return NULL; |
221 | 221 | ||
222 | memset(pvc, 0, sizeof(pvc_device)); | ||
223 | pvc->dlci = dlci; | 222 | pvc->dlci = dlci; |
224 | pvc->frad = dev; | 223 | pvc->frad = dev; |
225 | pvc->next = *pvc_p; /* Put it in the chain */ | 224 | pvc->next = *pvc_p; /* Put it in the chain */ |