summaryrefslogtreecommitdiff
path: root/sys/netccitt
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2001-05-16 12:54:35 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2001-05-16 12:54:35 +0000
commit60de2c41ea2b387be2e4b7b9b565329dd0a61c36 (patch)
tree8652597c096bbc850f6862988cd18624122c0051 /sys/netccitt
parent87f10021e726a2d2d79e079d9fe15180e3023b3e (diff)
No need to check M_WAIT/M_WAITOK malloc return values. (art@ ok)
Diffstat (limited to 'sys/netccitt')
-rw-r--r--sys/netccitt/pk_input.c28
-rw-r--r--sys/netccitt/pk_llcsubr.c8
-rw-r--r--sys/netccitt/pk_usrreq.c6
3 files changed, 15 insertions, 27 deletions
diff --git a/sys/netccitt/pk_input.c b/sys/netccitt/pk_input.c
index 7ed158197d9..3168d722bf8 100644
--- a/sys/netccitt/pk_input.c
+++ b/sys/netccitt/pk_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pk_input.c,v 1.2 1996/03/04 07:36:41 niklas Exp $ */
+/* $OpenBSD: pk_input.c,v 1.3 2001/05/16 12:53:35 ho Exp $ */
/* $NetBSD: pk_input.c,v 1.7 1996/02/13 22:05:21 christos Exp $ */
/*
@@ -120,8 +120,6 @@ pk_newlink(ia, llnext)
*/
size = sizeof(struct pkcb);
pkp = (struct pkcb *) malloc(size, M_PCB, M_WAITOK);
- if (pkp == 0)
- return ((struct pkcb *) 0);
bzero((caddr_t) pkp, size);
pkp->pk_lloutput = pp->pr_output;
pkp->pk_llctlinput = pp->pr_ctlinput;
@@ -227,22 +225,16 @@ pk_resize(pkp)
pkp->pk_maxlcn = xcp->xc_maxlcn;
size = (pkp->pk_maxlcn + 1) * sizeof(struct pklcd *);
pkp->pk_chan = malloc(size, M_IFADDR, M_WAITOK);
- if (pkp->pk_chan) {
- bzero((caddr_t) pkp->pk_chan, size);
- /*
- * Allocate a logical channel descriptor for lcn 0
- */
- if (dev_lcp == 0 &&
- (dev_lcp = pk_attach((struct socket *) 0)) == 0)
- return (ENOBUFS);
- dev_lcp->lcd_state = READY;
- dev_lcp->lcd_pkp = pkp;
- pkp->pk_chan[0] = dev_lcp;
- } else {
- if (dev_lcp)
- pk_close(dev_lcp);
+ bzero((caddr_t) pkp->pk_chan, size);
+ /*
+ * Allocate a logical channel descriptor for lcn 0
+ */
+ if (dev_lcp == 0 &&
+ (dev_lcp = pk_attach((struct socket *) 0)) == 0)
return (ENOBUFS);
- }
+ dev_lcp->lcd_state = READY;
+ dev_lcp->lcd_pkp = pkp;
+ pkp->pk_chan[0] = dev_lcp;
}
return 0;
}
diff --git a/sys/netccitt/pk_llcsubr.c b/sys/netccitt/pk_llcsubr.c
index 2becb73d7fc..61b32fc48ed 100644
--- a/sys/netccitt/pk_llcsubr.c
+++ b/sys/netccitt/pk_llcsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pk_llcsubr.c,v 1.4 2001/01/19 06:37:37 itojun Exp $ */
+/* $OpenBSD: pk_llcsubr.c,v 1.5 2001/05/16 12:53:35 ho Exp $ */
/* $NetBSD: pk_llcsubr.c,v 1.4 1996/02/13 22:05:26 christos Exp $ */
/*
@@ -331,10 +331,8 @@ npaidb_enter(key, value, rt, link)
npdl_netmask.sdl_data[i] = -1;
nprt->rt_llinfo = malloc(size, M_PCB, M_WAITOK);
- if (nprt->rt_llinfo) {
- bzero(nprt->rt_llinfo, size);
- ((struct npaidbentry *) (nprt->rt_llinfo))->np_rt = rt;
- }
+ bzero(nprt->rt_llinfo, size);
+ ((struct npaidbentry *) (nprt->rt_llinfo))->np_rt = rt;
} else
nprt->rt_refcnt--;
return nprt;
diff --git a/sys/netccitt/pk_usrreq.c b/sys/netccitt/pk_usrreq.c
index 8fa4c9b476c..24e1e334a74 100644
--- a/sys/netccitt/pk_usrreq.c
+++ b/sys/netccitt/pk_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pk_usrreq.c,v 1.2 1996/03/04 07:36:47 niklas Exp $ */
+/* $OpenBSD: pk_usrreq.c,v 1.3 2001/05/16 12:53:35 ho Exp $ */
/* $NetBSD: pk_usrreq.c,v 1.10 1996/02/13 22:05:43 christos Exp $ */
/*
@@ -360,8 +360,6 @@ pk_control(so, cmd, data, ifp)
if (ifa == (struct ifaddr *) 0) {
MALLOC(ia, struct x25_ifaddr *, sizeof(*ia),
M_IFADDR, M_WAITOK);
- if (ia == 0)
- return (ENOBUFS);
bzero((caddr_t) ia, sizeof(*ia));
TAILQ_INSERT_TAIL(&ifp->if_addrlist, &ia->ia_ifa,
ifa_list);
@@ -570,7 +568,7 @@ pk_send(m, v)
if (m->m_pkthdr.len > 32)
error = EMSGSIZE;
M_PREPEND(m, PKHEADERLN, M_WAITOK);
- if (m == 0 || error)
+ if (error)
goto bad;
*(mtod(m, octet *)) = 0;
xp = mtod(m, struct x25_packet *);