[svn-commits] fjoe: freebsd/trunk r10321 - /freebsd/trunk/freebsd/ng_dahdi_netdev/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 4 03:04:00 CDT 2011


Author: fjoe
Date: Fri Nov  4 03:03:57 2011
New Revision: 10321

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10321
Log:
Allocate memory with M_WAITOK when creating netgraph nodes/graph.

Modified:
    freebsd/trunk/freebsd/ng_dahdi_netdev/ng_dahdi_netdev.c

Modified: freebsd/trunk/freebsd/ng_dahdi_netdev/ng_dahdi_netdev.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/ng_dahdi_netdev/ng_dahdi_netdev.c?view=diff&rev=10321&r1=10320&r2=10321
==============================================================================
--- freebsd/trunk/freebsd/ng_dahdi_netdev/ng_dahdi_netdev.c (original)
+++ freebsd/trunk/freebsd/ng_dahdi_netdev/ng_dahdi_netdev.c Fri Nov  4 03:03:57 2011
@@ -223,12 +223,7 @@
 	}
 
 	/* create new network device */
-	netdev = malloc(sizeof(*netdev), M_DAHDI_NETDEV, M_NOWAIT | M_ZERO);
-	if (netdev == NULL) {
-		printf("dahdi_netdev(%s): Error: can not create netdevice\n",
-		    node_name);
-		goto error;
-	}
+	netdev = malloc(sizeof(*netdev), M_DAHDI_NETDEV, M_WAITOK | M_ZERO);
 	strlcpy(netdev->name, devname, sizeof(netdev->name));
 
 	/* create new DAHDI netgraph node */
@@ -259,12 +254,7 @@
 	}
 
 	/* get ethernet address */
-	NG_MKMESSAGE(msg, NGM_ETHER_COOKIE, NGM_ETHER_GET_ENADDR, 0, M_NOWAIT);
-	if (msg == NULL) {
-		printf("dahdi_netdev(%s): Error: can not allocate NGM_ETHER_GET_ENADDR message\n",
-		    NG_NODE_NAME(node));
-		return (0);
-	}
+	NG_MKMESSAGE(msg, NGM_ETHER_COOKIE, NGM_ETHER_GET_ENADDR, 0, M_WAITOK);
 	NG_SEND_MSG_ID(error, node, msg, NG_NODE_ID(ether_node), NG_NODE_ID(node));
 	if (error) {
 		printf("dahdi_netdev(%s): Error: NGM_ETHER_GET_ENADDR: error %d\n",
@@ -275,13 +265,7 @@
 	ether_node = NULL;
 
 	/* connect to ether "orphans" hook */
-	NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT,
-	    sizeof(*nc), M_NOWAIT);
-	if (msg == NULL) {
-		printf("dahdi_netdev(%s): Error: can not allocate NGM_CONNECT message\n",
-		    NG_NODE_NAME(node));
-		goto error;
-	}
+	NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT, sizeof(*nc), M_WAITOK);
 	nc = (struct ngm_connect *) msg->data;
 	snprintf(nc->path, sizeof(nc->path), "%s:", devname);
 	strlcpy(nc->ourhook, DAHDI_NETDEV_HOOK_UPPER, sizeof(nc->ourhook));




More information about the svn-commits mailing list