[openib-general] [PATCHv2] kDAPL: kmalloc needs no cast

Tom Duffy tduffy at sun.com
Fri May 20 15:28:32 PDT 2005


This is a repost rebased off of r2427.

Please apply after my v2 of the sizeof patch.

Signed-off-by: Tom Duffy <tduffy at sun.com>

diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat/dictionary.c linux-kernel-kmalloc/dat/dictionary.c
--- linux-kernel-sizeof/dat/dictionary.c	2005-05-20 09:55:56.230003000 -0700
+++ linux-kernel-kmalloc/dat/dictionary.c	2005-05-20 15:19:47.778968000 -0700
@@ -97,7 +97,7 @@ u32 dat_dictionary_entry_create(struct d
 	BUG_ON(NULL == p_entry);
 
 	entry = kmalloc(sizeof *entry, GFP_ATOMIC);
-	if (NULL == entry) {
+	if (!entry) {
 		status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
 		goto bail;
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat/dr.c linux-kernel-kmalloc/dat/dr.c
--- linux-kernel-sizeof/dat/dr.c	2005-05-20 09:56:11.726007000 -0700
+++ linux-kernel-kmalloc/dat/dr.c	2005-05-20 15:19:47.787972000 -0700
@@ -85,7 +85,7 @@ u32 dat_dr_insert(const struct dat_provi
 	u32 status;
 
 	data = kmalloc(sizeof *data, GFP_ATOMIC);
-	if (NULL == data) {
+	if (!data) {
 		status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, 
 				   DAT_RESOURCE_MEMORY);
 		goto bail;
@@ -242,7 +242,7 @@ u32 dat_dr_list(int max_to_return, int *
 		}
 
 		array = kmalloc(array_size * sizeof *array, GFP_ATOMIC);
-		if (NULL == array) {
+		if (!array) {
 			status =
 			    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
 				      DAT_RESOURCE_MEMORY);
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_cookie.c linux-kernel-kmalloc/dat-provider/dapl_cookie.c
--- linux-kernel-sizeof/dat-provider/dapl_cookie.c	2005-05-20 10:47:10.741014000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_cookie.c	2005-05-20 15:19:47.793960000 -0700
@@ -124,7 +124,7 @@ u32 dapl_cb_create(DAPL_COOKIE_BUFFER *b
 	size++;
 
 	buffer->pool = kmalloc(size * sizeof *buffer->pool, GFP_ATOMIC);
-	if (NULL != buffer->pool) {
+	if (buffer->pool) {
 		buffer->pool_size = size;
 		atomic_set(&buffer->head, 0);
 		atomic_set(&buffer->tail, 0);
@@ -135,9 +135,8 @@ u32 dapl_cb_create(DAPL_COOKIE_BUFFER *b
 		}
 
 		return DAT_SUCCESS;
-	} else {
+	} else
 		return DAT_INSUFFICIENT_RESOURCES;
-	}
 }
 
 /*
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_cr_util.c linux-kernel-kmalloc/dat-provider/dapl_cr_util.c
--- linux-kernel-sizeof/dat-provider/dapl_cr_util.c	2005-05-20 09:39:00.781014000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_cr_util.c	2005-05-20 15:19:47.797971000 -0700
@@ -42,10 +42,9 @@ DAPL_CR *dapl_cr_alloc(DAPL_IA * ia_ptr)
 	DAPL_CR *cr_ptr;
 
 	/* Allocate EP */
-	cr_ptr = (DAPL_CR *) kmalloc(sizeof *cr_ptr, GFP_ATOMIC);
-	if (cr_ptr == NULL) {
+	cr_ptr = kmalloc(sizeof *cr_ptr, GFP_ATOMIC);
+	if (!cr_ptr)
 		return NULL;
-	}
 
 	/* zero the structure */
 	memset(cr_ptr, 0, sizeof *cr_ptr);
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_ep_connect.c linux-kernel-kmalloc/dat-provider/dapl_ep_connect.c
--- linux-kernel-sizeof/dat-provider/dapl_ep_connect.c	2005-05-20 15:12:36.692972000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_ep_connect.c	2005-05-20 15:22:16.513960000 -0700
@@ -280,8 +280,13 @@ u32 dapl_ep_connect(DAT_EP_HANDLE ep_han
 		if (ep_ptr->param.ep_state == 
 			DAT_EP_STATE_ACTIVE_CONNECTION_PENDING
 		    && timeout != DAT_TIMEOUT_INFINITE) {
-			ep_ptr->cxn_timer = (struct dapl_timer_entry *)
-			    kmalloc(sizeof *ep_ptr->cxn_timer, GFP_ATOMIC);
+			ep_ptr->cxn_timer = kmalloc(sizeof *ep_ptr->cxn_timer,
+						    GFP_ATOMIC);
+			if (!ep_ptr->cxn_timer) {
+				dat_status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
+						       DAT_RESOURCE_MEMORY);
+				goto bail;
+			}
 
 			dapl_timer_set(ep_ptr->cxn_timer,
 				       dapl_ep_timeout, ep_ptr, timeout);
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_ep_modify.c linux-kernel-kmalloc/dat-provider/dapl_ep_modify.c
--- linux-kernel-sizeof/dat-provider/dapl_ep_modify.c	2005-05-20 15:13:44.645961000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_ep_modify.c	2005-05-20 15:19:47.835961000 -0700
@@ -386,7 +386,7 @@ u32 dapl_ep_modify(DAT_EP_HANDLE ep_hand
 	alloc_ep.send_iov_num = ep_attr1.max_request_iov;
 	alloc_ep.send_iov = kmalloc(ep_attr1.max_request_iov
 				    * sizeof *alloc_ep.send_iov, GFP_ATOMIC);
-	if (alloc_ep.recv_iov == NULL) {
+	if (!alloc_ep.recv_iov) {
 		dat_status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
 		goto bail;
@@ -396,7 +396,7 @@ u32 dapl_ep_modify(DAT_EP_HANDLE ep_hand
 	alloc_ep.recv_iov_num = ep_attr1.max_recv_iov;
 	alloc_ep.recv_iov = kmalloc(ep_attr1.max_recv_iov
 				    * sizeof *alloc_ep.recv_iov, GFP_ATOMIC);
-	if (alloc_ep.recv_iov == NULL) {
+	if (!alloc_ep.recv_iov) {
 		dat_status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
 		goto bail;
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_ep_util.c linux-kernel-kmalloc/dat-provider/dapl_ep_util.c
--- linux-kernel-sizeof/dat-provider/dapl_ep_util.c	2005-05-20 15:14:06.429964000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_ep_util.c	2005-05-20 15:19:47.840972000 -0700
@@ -60,9 +60,8 @@ DAPL_EP *dapl_ep_alloc(DAPL_IA * ia_ptr,
 	DAPL_EP *ep_ptr;
 
 	/* Allocate EP */
-	ep_ptr = (DAPL_EP *) kmalloc(sizeof *ep_ptr + sizeof (struct sockaddr), 
-				     GFP_ATOMIC);
-	if (ep_ptr == NULL)
+	ep_ptr = kmalloc(sizeof *ep_ptr + sizeof (struct sockaddr), GFP_ATOMIC);
+	if (!ep_ptr)
 		goto bail;
 
 	/* zero the structure */
@@ -126,8 +125,7 @@ DAPL_EP *dapl_ep_alloc(DAPL_IA * ia_ptr,
 
 	ep_ptr->recv_iov = kmalloc(ep_ptr->recv_iov_num * 
 				   sizeof *ep_ptr->recv_iov, GFP_ATOMIC);
-
-	if (NULL == ep_ptr->recv_iov) {
+	if (!ep_ptr->recv_iov) {
 		dapl_ep_dealloc(ep_ptr);
 		ep_ptr = NULL;
 		goto bail;
@@ -135,8 +133,7 @@ DAPL_EP *dapl_ep_alloc(DAPL_IA * ia_ptr,
 
 	ep_ptr->send_iov = kmalloc(ep_ptr->send_iov_num * 
 				   sizeof *ep_ptr->send_iov, GFP_ATOMIC);
-
-	if (NULL == ep_ptr->send_iov) {
+	if (!ep_ptr->send_iov) {
 		dapl_ep_dealloc(ep_ptr);
 		ep_ptr = NULL;
 		goto bail;
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_evd_util.c linux-kernel-kmalloc/dat-provider/dapl_evd_util.c
--- linux-kernel-sizeof/dat-provider/dapl_evd_util.c	2005-05-20 15:15:32.618966000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_evd_util.c	2005-05-20 15:19:47.867963000 -0700
@@ -123,10 +123,9 @@ DAPL_EVD *dapl_evd_alloc(DAPL_IA * ia_pt
 	DAPL_EVD *evd_ptr;
 
 	/* Allocate EVD */
-	evd_ptr = (DAPL_EVD *) kmalloc(sizeof *evd_ptr, GFP_ATOMIC);
-	if (!evd_ptr) {
+	evd_ptr = kmalloc(sizeof *evd_ptr, GFP_ATOMIC);
+	if (!evd_ptr)
 		goto bail;
-	}
 
 	/* zero the structure */
 	memset(evd_ptr, 0, sizeof *evd_ptr);
@@ -169,10 +168,8 @@ u32 dapl_evd_event_alloc(DAPL_EVD *evd_p
 	u32 dat_status = DAT_SUCCESS;
 
 	/* Allocate EVENTs */
-	event_ptr =
-	    (struct dat_event *)kmalloc(evd_ptr->qlen * sizeof *event_ptr,
-					GFP_ATOMIC);
-	if (event_ptr == NULL) {
+	event_ptr = kmalloc(evd_ptr->qlen * sizeof *event_ptr, GFP_ATOMIC);
+	if (!event_ptr) {
 		dat_status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
 		goto bail;
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_hash.c linux-kernel-kmalloc/dat-provider/dapl_hash.c
--- linux-kernel-sizeof/dat-provider/dapl_hash.c	2005-05-20 10:10:06.017003000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_hash.c	2005-05-20 15:19:47.873960000 -0700
@@ -213,8 +213,8 @@ dapl_hash_add(DAPL_HASH_TABLEP p_table, 
 		p_table->num_entries++;
 		status = TRUE;
 	} else {
-		DAPL_HASH_ELEM *newelement = (DAPL_HASH_ELEM *)
-		    kmalloc(sizeof *newelement, GFP_ATOMIC);
+		DAPL_HASH_ELEM *newelement = kmalloc(sizeof *newelement,
+						     GFP_ATOMIC);
 		/*
 		 * Add an element to the end of the chain
 		 */
@@ -232,10 +232,8 @@ dapl_hash_add(DAPL_HASH_TABLEP p_table, 
 			lastelement->next_element = newelement;
 			p_table->num_entries++;
 			status = TRUE;
-		} else {
-			/* allocation failed - should not happen */
+		} else
 			status = FALSE;
-		}
 	}
 
 	/*
@@ -332,7 +330,7 @@ u32 dapl_hash_create(int table_size, DAP
 
 	/* Allocate hash table */
 	p_table = kmalloc(sizeof *p_table, GFP_ATOMIC);
-	if (NULL == p_table) {
+	if (!p_table) {
 		dat_status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
 		goto bail;
@@ -341,8 +339,8 @@ u32 dapl_hash_create(int table_size, DAP
 	/* Init hash table, allocate and init and buckets */
 	memset(p_table, 0, sizeof *p_table);
 	p_table->tbl_size = table_size;
-	p_table->table = (DAPL_HASH_ELEM *) kmalloc(table_length, GFP_ATOMIC);
-	if (NULL == p_table->table) {
+	p_table->table = kmalloc(table_length, GFP_ATOMIC);
+	if (!p_table->table) {
 		kfree(p_table);
 		dat_status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_hca_util.c linux-kernel-kmalloc/dat-provider/dapl_hca_util.c
--- linux-kernel-sizeof/dat-provider/dapl_hca_util.c	2005-05-20 15:11:31.050974000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_hca_util.c	2005-05-20 15:19:47.878970000 -0700
@@ -61,7 +61,7 @@ DAPL_HCA *dapl_hca_alloc(char *name, str
 	DAPL_HCA *hca_ptr;
 
 	hca_ptr = kmalloc(sizeof *hca_ptr, GFP_ATOMIC);
-	if (NULL != hca_ptr) {
+	if (hca_ptr) {
 		memset(hca_ptr, 0, sizeof *hca_ptr);
 
 		if (DAT_SUCCESS ==
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_ia_util.c linux-kernel-kmalloc/dat-provider/dapl_ia_util.c
--- linux-kernel-sizeof/dat-provider/dapl_ia_util.c	2005-05-20 15:11:31.438968000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_ia_util.c	2005-05-20 15:19:47.884961000 -0700
@@ -63,10 +63,9 @@ DAPL_IA *dapl_ia_alloc(struct dat_provid
 	DAPL_IA *ia_ptr;
 
 	/* Allocate IA */
-	ia_ptr = (DAPL_IA *) kmalloc(sizeof *ia_ptr, GFP_ATOMIC);
-	if (ia_ptr == NULL) {
+	ia_ptr = kmalloc(sizeof *ia_ptr, GFP_ATOMIC);
+	if (!ia_ptr)
 		return NULL;
-	}
 
 	/* zero the structure */
 	memset(ia_ptr, 0, sizeof *ia_ptr);
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_lmr_util.c linux-kernel-kmalloc/dat-provider/dapl_lmr_util.c
--- linux-kernel-sizeof/dat-provider/dapl_lmr_util.c	2005-05-20 09:45:43.253013000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_lmr_util.c	2005-05-20 15:19:47.890970000 -0700
@@ -48,10 +48,9 @@ DAPL_LMR *dapl_lmr_alloc(DAPL_IA * ia,
 	DAPL_LMR *lmr;
 
 	/* Allocate LMR */
-	lmr = (DAPL_LMR *) kmalloc(sizeof *lmr, GFP_ATOMIC);
-	if (NULL == lmr) {
+	lmr = kmalloc(sizeof *lmr, GFP_ATOMIC);
+	if (!lmr)
 		return NULL;
-	}
 
 	/* zero the structure */
 	memset(lmr, 0, sizeof *lmr);
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_openib_util.c linux-kernel-kmalloc/dat-provider/dapl_openib_util.c
--- linux-kernel-sizeof/dat-provider/dapl_openib_util.c	2005-05-20 15:11:31.746962000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_openib_util.c	2005-05-20 15:19:47.920964000 -0700
@@ -408,9 +408,8 @@ u32 dapl_ib_mr_register_physical(DAPL_IA
 	u64 *array;
 
 	array = (u64 *) phys_addr;
-	buf_list = (struct ib_phys_buf *) 
-		kmalloc(length * sizeof *buf_list, GFP_ATOMIC);
-	if (NULL == buf_list)
+	buf_list = kmalloc(length * sizeof *buf_list, GFP_ATOMIC);
+	if (!buf_list)
 		return DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
 				 DAT_RESOURCE_MEMORY);
 
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_provider.c linux-kernel-kmalloc/dat-provider/dapl_provider.c
--- linux-kernel-sizeof/dat-provider/dapl_provider.c	2005-05-20 09:53:27.437003000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_provider.c	2005-05-20 15:19:47.926965000 -0700
@@ -151,7 +151,7 @@ u32 dapl_provider_list_create(void)
 	/* create the head node */
 	g_dapl_provider_list.head =
 	    kmalloc(sizeof *g_dapl_provider_list.head, GFP_ATOMIC);
-	if (NULL == g_dapl_provider_list.head) {
+	if (!g_dapl_provider_list.head) {
 		status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
 		goto bail;
@@ -162,7 +162,7 @@ u32 dapl_provider_list_create(void)
 	/* create the tail node */
 	g_dapl_provider_list.tail =
 	    kmalloc(sizeof *g_dapl_provider_list.tail, GFP_ATOMIC);
-	if (NULL == g_dapl_provider_list.tail) {
+	if (!g_dapl_provider_list.tail) {
 		status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
 		goto bail;
@@ -214,8 +214,7 @@ u32 dapl_provider_list_insert(const char
 	unsigned int len;
 
 	cur_node = kmalloc(sizeof *cur_node, GFP_ATOMIC);
-
-	if (NULL == cur_node) {
+	if (!cur_node) {
 		status =
 		    DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, DAT_RESOURCE_MEMORY);
 		goto bail;
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_pz_util.c linux-kernel-kmalloc/dat-provider/dapl_pz_util.c
--- linux-kernel-sizeof/dat-provider/dapl_pz_util.c	2005-05-20 15:11:31.492027000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_pz_util.c	2005-05-20 15:23:13.954961000 -0700
@@ -57,8 +57,8 @@ DAPL_PZ *dapl_pz_alloc(DAPL_IA * ia)
 	DAPL_PZ *pz;
 
 	/* Allocate PZ */
-	pz = (DAPL_PZ *) kmalloc(sizeof *pz, GFP_ATOMIC);
-	if (NULL == pz) 
+	pz = kmalloc(sizeof *pz, GFP_ATOMIC);
+	if (!pz) 
 		return NULL;
 
 	/* zero the structure */
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_ring_buffer_util.c linux-kernel-kmalloc/dat-provider/dapl_ring_buffer_util.c
--- linux-kernel-sizeof/dat-provider/dapl_ring_buffer_util.c	2005-05-20 15:11:30.864961000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_ring_buffer_util.c	2005-05-20 15:19:47.959972000 -0700
@@ -72,14 +72,13 @@ u32 dapl_rbuf_alloc(DAPL_RING_BUFFER *rb
 		rsize <<= 1;
 	}
 
-	rbuf->base = (void *) kmalloc(rsize * sizeof *rbuf->base, GFP_ATOMIC);
-	if (rbuf->base != NULL) {
+	rbuf->base = kmalloc(rsize * sizeof *rbuf->base, GFP_ATOMIC);
+	if (rbuf->base) {
 		rbuf->lim = rsize - 1;
 		atomic_set(&rbuf->head, 0);
 		atomic_set(&rbuf->tail, 0);
-	} else {
+	} else
 		return DAT_INSUFFICIENT_RESOURCES | DAT_RESOURCE_MEMORY;
-	}
 
 	return DAT_SUCCESS;
 }
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_rmr_util.c linux-kernel-kmalloc/dat-provider/dapl_rmr_util.c
--- linux-kernel-sizeof/dat-provider/dapl_rmr_util.c	2005-05-20 09:54:37.797008000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_rmr_util.c	2005-05-20 15:19:47.964962000 -0700
@@ -33,10 +33,9 @@ DAPL_RMR *dapl_rmr_alloc(DAPL_PZ * pz)
 	DAPL_RMR *rmr;
 
 	/* Allocate LMR */
-	rmr = (DAPL_RMR *) kmalloc(sizeof *rmr, GFP_ATOMIC);
-	if (NULL == rmr) {
+	rmr = kmalloc(sizeof *rmr, GFP_ATOMIC);
+	if (!rmr)
 		return NULL;
-	}
 
 	/* zero the structure */
 	memset(rmr, 0, sizeof *rmr);
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_sp_util.c linux-kernel-kmalloc/dat-provider/dapl_sp_util.c
--- linux-kernel-sizeof/dat-provider/dapl_sp_util.c	2005-05-20 15:11:32.615964000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_sp_util.c	2005-05-20 15:19:47.969972000 -0700
@@ -64,8 +64,8 @@ DAPL_SP *dapl_sp_alloc(DAPL_IA * ia_ptr,
 	DAPL_SP *sp_ptr;
 
 	/* Allocate EP */
-	sp_ptr = (DAPL_SP *) kmalloc(sizeof *sp_ptr, GFP_ATOMIC);
-	if (sp_ptr == NULL) 
+	sp_ptr = kmalloc(sizeof *sp_ptr, GFP_ATOMIC);
+	if (!sp_ptr) 
 		return NULL;
 
 	/* zero the structure */
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_srq_util.c linux-kernel-kmalloc/dat-provider/dapl_srq_util.c
--- linux-kernel-sizeof/dat-provider/dapl_srq_util.c	2005-05-20 09:55:16.196002000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_srq_util.c	2005-05-20 15:19:47.973961000 -0700
@@ -59,11 +59,9 @@ DAPL_SRQ *dapl_srq_alloc(DAPL_IA * ia_pt
 	DAPL_SRQ *srq_ptr;
 
 	/* Allocate SRQ */
-	srq_ptr = (DAPL_SRQ *) kmalloc(sizeof *srq_ptr, GFP_ATOMIC);
-
-	if (srq_ptr == NULL) {
+	srq_ptr = kmalloc(sizeof *srq_ptr, GFP_ATOMIC);
+	if (!srq_ptr)
 		goto bail;
-	}
 
 	/* zero the structure */
 	memset(srq_ptr, 0, sizeof *srq_ptr);
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-sizeof/dat-provider/dapl_util.h linux-kernel-kmalloc/dat-provider/dapl_util.h
--- linux-kernel-sizeof/dat-provider/dapl_util.h	2005-05-20 15:11:32.661977000 -0700
+++ linux-kernel-kmalloc/dat-provider/dapl_util.h	2005-05-20 15:19:47.999965000 -0700
@@ -144,7 +144,7 @@ static inline void *dapl_os_realloc(void
 	void *newptr;
 
 	newptr = kmalloc(size, GFP_ATOMIC);
-	if (newptr != NULL) {
+	if (newptr) {
 		/* copy the mem array to the new */
 		memcpy(newptr, ptr, size);
 		kfree(ptr);
@@ -159,9 +159,8 @@ static inline void *dapl_os_realloc(void
 static inline char *dapl_os_strdup(const char *str)
 {
 	char *ns = kmalloc(strlen(str) + 1, GFP_KERNEL);
-	if (ns) {
+	if (ns)
 		strcpy(ns, str);
-	}
 	return ns;
 }
 




More information about the general mailing list