Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2016 10:21:03 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r299351 - head/sys/dev/firewire
Message-ID:  <201605101021.u4AAL3iR073177@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue May 10 10:21:03 2016
New Revision: 299351
URL: https://svnweb.freebsd.org/changeset/base/299351

Log:
  Remove NULL checks after M_WAITOK allocations from firewire.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/firewire/fwdev.c
  head/sys/dev/firewire/fwdma.c
  head/sys/dev/firewire/fwmem.c
  head/sys/dev/firewire/fwohci.c
  head/sys/dev/firewire/if_fwe.c

Modified: head/sys/dev/firewire/fwdev.c
==============================================================================
--- head/sys/dev/firewire/fwdev.c	Tue May 10 09:58:51 2016	(r299350)
+++ head/sys/dev/firewire/fwdev.c	Tue May 10 10:21:03 2016	(r299351)
@@ -102,8 +102,6 @@ fwdev_allocbuf(struct firewire_comm *fc,
 
 	q->bulkxfer = malloc(sizeof(struct fw_bulkxfer) * b->nchunk,
 	    M_FW, M_WAITOK);
-	if (q->bulkxfer == NULL)
-		return (ENOMEM);
 
 	b->psize = roundup2(b->psize, sizeof(uint32_t));
 	q->buf = fwdma_malloc_multiseg(fc, sizeof(uint32_t),
@@ -179,8 +177,6 @@ fw_open(struct cdev *dev, int flags, int
 	FW_GUNLOCK(sc->fc);
 
 	dev->si_drv1 = malloc(sizeof(struct fw_drv1), M_FW, M_WAITOK | M_ZERO);
-	if (dev->si_drv1 == NULL)
-		return (ENOMEM);
 
 	if ((dev->si_flags & SI_NAMED) == 0) {
 		int unit = DEV2UNIT(dev);
@@ -742,10 +738,6 @@ out:
 			break;
 		}
 		fwb = malloc(sizeof(struct fw_bind), M_FW, M_WAITOK);
-		if (fwb == NULL) {
-			err = ENOMEM;
-			break;
-		}
 		fwb->start = ((u_int64_t)bindreq->start.hi << 32) |
 		    bindreq->start.lo;
 		fwb->end = fwb->start +  bindreq->len;

Modified: head/sys/dev/firewire/fwdma.c
==============================================================================
--- head/sys/dev/firewire/fwdma.c	Tue May 10 09:58:51 2016	(r299350)
+++ head/sys/dev/firewire/fwdma.c	Tue May 10 10:21:03 2016	(r299351)
@@ -160,10 +160,6 @@ fwdma_malloc_multiseg(struct firewire_co
 	}
 	am = (struct fwdma_alloc_multi *)malloc(sizeof(struct fwdma_alloc_multi)
 			+ sizeof(struct fwdma_seg)*nseg, M_FW, M_WAITOK);
-	if (am == NULL) {
-		printf("fwdma_malloc_multiseg: malloc failed\n");
-		return (NULL);
-	}
 	am->ssize = ssize;
 	am->esize = esize;
 	am->nseg = 0;

Modified: head/sys/dev/firewire/fwmem.c
==============================================================================
--- head/sys/dev/firewire/fwmem.c	Tue May 10 09:58:51 2016	(r299350)
+++ head/sys/dev/firewire/fwmem.c	Tue May 10 10:21:03 2016	(r299351)
@@ -287,8 +287,6 @@ fwmem_open(struct cdev *dev, int flags, 
 		FW_GUNLOCK(sc->fc);
 		dev->si_drv1 = malloc(sizeof(struct fwmem_softc),
 		    M_FWMEM, M_WAITOK);
-		if (dev->si_drv1 == NULL)
-			return (ENOMEM);
 		dev->si_iosize_max = DFLTPHYS;
 		fms = dev->si_drv1;
 		bcopy(&fwmem_eui64, &fms->eui, sizeof(struct fw_eui64));

Modified: head/sys/dev/firewire/fwohci.c
==============================================================================
--- head/sys/dev/firewire/fwohci.c	Tue May 10 09:58:51 2016	(r299350)
+++ head/sys/dev/firewire/fwohci.c	Tue May 10 10:21:03 2016	(r299351)
@@ -1247,10 +1247,6 @@ fwohci_db_init(struct fwohci_softc *sc, 
 	db_tr = (struct fwohcidb_tr *)
 		malloc(sizeof(struct fwohcidb_tr) * dbch->ndb,
 		M_FW, M_WAITOK | M_ZERO);
-	if (db_tr == NULL) {
-		printf("fwohci_db_init: malloc(1) failed\n");
-		return;
-	}
 
 #define DB_SIZE(x) (sizeof(struct fwohcidb) * (x)->ndesc)
 	dbch->am = fwdma_malloc_multiseg(&sc->fc, sizeof(struct fwohcidb),

Modified: head/sys/dev/firewire/if_fwe.c
==============================================================================
--- head/sys/dev/firewire/if_fwe.c	Tue May 10 09:58:51 2016	(r299350)
+++ head/sys/dev/firewire/if_fwe.c	Tue May 10 10:21:03 2016	(r299351)
@@ -307,10 +307,6 @@ fwe_init(void *arg)
 		xferq->bulkxfer = (struct fw_bulkxfer *) malloc(
 			sizeof(struct fw_bulkxfer) * xferq->bnchunk,
 							M_FWE, M_WAITOK);
-		if (xferq->bulkxfer == NULL) {
-			printf("if_fwe: malloc failed\n");
-			return;
-		}
 		STAILQ_INIT(&xferq->stvalid);
 		STAILQ_INIT(&xferq->stfree);
 		STAILQ_INIT(&xferq->stdma);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605101021.u4AAL3iR073177>