aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/net')
-rw-r--r--drivers/s390/net/ctcmain.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
index 0d6d5fcc128b..570a960bfb5b 100644
--- a/drivers/s390/net/ctcmain.c
+++ b/drivers/s390/net/ctcmain.c
@@ -1638,21 +1638,19 @@ add_channel(struct ccw_device *cdev, enum channel_types type)
1638 struct channel *ch; 1638 struct channel *ch;
1639 1639
1640 DBF_TEXT(trace, 2, __FUNCTION__); 1640 DBF_TEXT(trace, 2, __FUNCTION__);
1641 if ((ch = 1641 ch = kzalloc(sizeof(struct channel), GFP_KERNEL);
1642 (struct channel *) kmalloc(sizeof (struct channel), 1642 if (!ch) {
1643 GFP_KERNEL)) == NULL) {
1644 ctc_pr_warn("ctc: Out of memory in add_channel\n"); 1643 ctc_pr_warn("ctc: Out of memory in add_channel\n");
1645 return -1; 1644 return -1;
1646 } 1645 }
1647 memset(ch, 0, sizeof (struct channel)); 1646 /* assure all flags and counters are reset */
1648 if ((ch->ccw = kmalloc(8*sizeof(struct ccw1), 1647 ch->ccw = kzalloc(8 * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
1649 GFP_KERNEL | GFP_DMA)) == NULL) { 1648 if (!ch->ccw) {
1650 kfree(ch); 1649 kfree(ch);
1651 ctc_pr_warn("ctc: Out of memory in add_channel\n"); 1650 ctc_pr_warn("ctc: Out of memory in add_channel\n");
1652 return -1; 1651 return -1;
1653 } 1652 }
1654 1653
1655 memset(ch->ccw, 0, 8*sizeof(struct ccw1)); // assure all flags and counters are reset
1656 1654
1657 /** 1655 /**
1658 * "static" ccws are used in the following way: 1656 * "static" ccws are used in the following way:
@@ -1692,15 +1690,14 @@ add_channel(struct ccw_device *cdev, enum channel_types type)
1692 return -1; 1690 return -1;
1693 } 1691 }
1694 fsm_newstate(ch->fsm, CH_STATE_IDLE); 1692 fsm_newstate(ch->fsm, CH_STATE_IDLE);
1695 if ((ch->irb = kmalloc(sizeof (struct irb), 1693 ch->irb = kzalloc(sizeof(struct irb), GFP_KERNEL);
1696 GFP_KERNEL)) == NULL) { 1694 if (!ch->irb) {
1697 ctc_pr_warn("ctc: Out of memory in add_channel\n"); 1695 ctc_pr_warn("ctc: Out of memory in add_channel\n");
1698 kfree_fsm(ch->fsm); 1696 kfree_fsm(ch->fsm);
1699 kfree(ch->ccw); 1697 kfree(ch->ccw);
1700 kfree(ch); 1698 kfree(ch);
1701 return -1; 1699 return -1;
1702 } 1700 }
1703 memset(ch->irb, 0, sizeof (struct irb));
1704 while (*c && less_than((*c)->id, ch->id)) 1701 while (*c && less_than((*c)->id, ch->id))
1705 c = &(*c)->next; 1702 c = &(*c)->next;
1706 if (*c && (!strncmp((*c)->id, ch->id, CTC_ID_SIZE))) { 1703 if (*c && (!strncmp((*c)->id, ch->id, CTC_ID_SIZE))) {
@@ -2745,14 +2742,13 @@ ctc_probe_device(struct ccwgroup_device *cgdev)
2745 if (!get_device(&cgdev->dev)) 2742 if (!get_device(&cgdev->dev))
2746 return -ENODEV; 2743 return -ENODEV;
2747 2744
2748 priv = kmalloc(sizeof (struct ctc_priv), GFP_KERNEL); 2745 priv = kzalloc(sizeof(struct ctc_priv), GFP_KERNEL);
2749 if (!priv) { 2746 if (!priv) {
2750 ctc_pr_err("%s: Out of memory\n", __func__); 2747 ctc_pr_err("%s: Out of memory\n", __func__);
2751 put_device(&cgdev->dev); 2748 put_device(&cgdev->dev);
2752 return -ENOMEM; 2749 return -ENOMEM;
2753 } 2750 }
2754 2751
2755 memset(priv, 0, sizeof (struct ctc_priv));
2756 rc = ctc_add_files(&cgdev->dev); 2752 rc = ctc_add_files(&cgdev->dev);
2757 if (rc) { 2753 if (rc) {
2758 kfree(priv); 2754 kfree(priv);
@@ -2793,10 +2789,9 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
2793 DBF_TEXT(setup, 3, __FUNCTION__); 2789 DBF_TEXT(setup, 3, __FUNCTION__);
2794 2790
2795 if (alloc_device) { 2791 if (alloc_device) {
2796 dev = kmalloc(sizeof (struct net_device), GFP_KERNEL); 2792 dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
2797 if (!dev) 2793 if (!dev)
2798 return NULL; 2794 return NULL;
2799 memset(dev, 0, sizeof (struct net_device));
2800 } 2795 }
2801 2796
2802 dev->priv = privptr; 2797 dev->priv = privptr;