RDS: cleanup: remove "== NULL"s and "!= NULL"s in ptr comparisons
Favor "if (foo)" style over "if (foo != NULL)". Signed-off-by: Andy Grover <andy.grover@oracle.com>
This commit is contained in:
@@ -53,7 +53,7 @@ static void rds_iw_frag_drop_page(struct rds_page_frag *frag)
|
||||
static void rds_iw_frag_free(struct rds_page_frag *frag)
|
||||
{
|
||||
rdsdebug("frag %p page %p\n", frag, frag->f_page);
|
||||
BUG_ON(frag->f_page != NULL);
|
||||
BUG_ON(frag->f_page);
|
||||
kmem_cache_free(rds_iw_frag_slab, frag);
|
||||
}
|
||||
|
||||
@@ -143,14 +143,14 @@ static int rds_iw_recv_refill_one(struct rds_connection *conn,
|
||||
struct ib_sge *sge;
|
||||
int ret = -ENOMEM;
|
||||
|
||||
if (recv->r_iwinc == NULL) {
|
||||
if (!recv->r_iwinc) {
|
||||
if (!atomic_add_unless(&rds_iw_allocation, 1, rds_iw_sysctl_max_recv_allocation)) {
|
||||
rds_iw_stats_inc(s_iw_rx_alloc_limit);
|
||||
goto out;
|
||||
}
|
||||
recv->r_iwinc = kmem_cache_alloc(rds_iw_incoming_slab,
|
||||
kptr_gfp);
|
||||
if (recv->r_iwinc == NULL) {
|
||||
if (!recv->r_iwinc) {
|
||||
atomic_dec(&rds_iw_allocation);
|
||||
goto out;
|
||||
}
|
||||
@@ -158,17 +158,17 @@ static int rds_iw_recv_refill_one(struct rds_connection *conn,
|
||||
rds_inc_init(&recv->r_iwinc->ii_inc, conn, conn->c_faddr);
|
||||
}
|
||||
|
||||
if (recv->r_frag == NULL) {
|
||||
if (!recv->r_frag) {
|
||||
recv->r_frag = kmem_cache_alloc(rds_iw_frag_slab, kptr_gfp);
|
||||
if (recv->r_frag == NULL)
|
||||
if (!recv->r_frag)
|
||||
goto out;
|
||||
INIT_LIST_HEAD(&recv->r_frag->f_item);
|
||||
recv->r_frag->f_page = NULL;
|
||||
}
|
||||
|
||||
if (ic->i_frag.f_page == NULL) {
|
||||
if (!ic->i_frag.f_page) {
|
||||
ic->i_frag.f_page = alloc_page(page_gfp);
|
||||
if (ic->i_frag.f_page == NULL)
|
||||
if (!ic->i_frag.f_page)
|
||||
goto out;
|
||||
ic->i_frag.f_offset = 0;
|
||||
}
|
||||
@@ -716,7 +716,7 @@ static void rds_iw_process_recv(struct rds_connection *conn,
|
||||
* into the inc and save the inc so we can hang upcoming fragments
|
||||
* off its list.
|
||||
*/
|
||||
if (iwinc == NULL) {
|
||||
if (!iwinc) {
|
||||
iwinc = recv->r_iwinc;
|
||||
recv->r_iwinc = NULL;
|
||||
ic->i_iwinc = iwinc;
|
||||
@@ -899,13 +899,13 @@ int __init rds_iw_recv_init(void)
|
||||
rds_iw_incoming_slab = kmem_cache_create("rds_iw_incoming",
|
||||
sizeof(struct rds_iw_incoming),
|
||||
0, 0, NULL);
|
||||
if (rds_iw_incoming_slab == NULL)
|
||||
if (!rds_iw_incoming_slab)
|
||||
goto out;
|
||||
|
||||
rds_iw_frag_slab = kmem_cache_create("rds_iw_frag",
|
||||
sizeof(struct rds_page_frag),
|
||||
0, 0, NULL);
|
||||
if (rds_iw_frag_slab == NULL)
|
||||
if (!rds_iw_frag_slab)
|
||||
kmem_cache_destroy(rds_iw_incoming_slab);
|
||||
else
|
||||
ret = 0;
|
||||
|
Reference in New Issue
Block a user