提交 d125a6c6 编写于 作者: J Jubin John 提交者: Doug Ledford

staging/rdma/hfi1: Fix comparison to NULL

Convert pointer comparisons to NULL to !pointer
to fix checkpatch check:
CHECK: Comparison to NULL could be written "!pointer"
Reviewed-by: NDennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: NIra Weiny <ira.weiny@intel.com>
Reviewed-by: NMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: NJubin John <jubin.john@intel.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 50e5dcbe
...@@ -12260,7 +12260,7 @@ u64 hfi1_gpio_mod(struct hfi1_devdata *dd, u32 target, u32 data, u32 dir, ...@@ -12260,7 +12260,7 @@ u64 hfi1_gpio_mod(struct hfi1_devdata *dd, u32 target, u32 data, u32 dir,
int hfi1_init_ctxt(struct send_context *sc) int hfi1_init_ctxt(struct send_context *sc)
{ {
if (sc != NULL) { if (sc) {
struct hfi1_devdata *dd = sc->dd; struct hfi1_devdata *dd = sc->dd;
u64 reg; u64 reg;
u8 set = (sc->type == SC_USER ? u8 set = (sc->type == SC_USER ?
...@@ -12371,7 +12371,7 @@ static void clean_up_interrupts(struct hfi1_devdata *dd) ...@@ -12371,7 +12371,7 @@ static void clean_up_interrupts(struct hfi1_devdata *dd)
struct hfi1_msix_entry *me = dd->msix_entries; struct hfi1_msix_entry *me = dd->msix_entries;
for (i = 0; i < dd->num_msix_entries; i++, me++) { for (i = 0; i < dd->num_msix_entries; i++, me++) {
if (me->arg == NULL) /* => no irq, no affinity */ if (!me->arg) /* => no irq, no affinity */
continue; continue;
hfi1_put_irq_affinity(dd, &dd->msix_entries[i]); hfi1_put_irq_affinity(dd, &dd->msix_entries[i]);
free_irq(me->msix.vector, me->arg); free_irq(me->msix.vector, me->arg);
...@@ -12534,7 +12534,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd) ...@@ -12534,7 +12534,7 @@ static int request_msix_irqs(struct hfi1_devdata *dd)
continue; continue;
} }
/* no argument, no interrupt */ /* no argument, no interrupt */
if (arg == NULL) if (!arg)
continue; continue;
/* make sure the name is terminated */ /* make sure the name is terminated */
me->name[sizeof(me->name) - 1] = 0; me->name[sizeof(me->name) - 1] = 0;
......
...@@ -746,7 +746,7 @@ void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd) ...@@ -746,7 +746,7 @@ void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd)
ibd->hfi1_ibdev_dbg, ibd->hfi1_ibdev_dbg,
ppd, ppd,
&port_cntr_ops[i].ops, &port_cntr_ops[i].ops,
port_cntr_ops[i].ops.write == NULL ? !port_cntr_ops[i].ops.write ?
S_IRUGO : S_IRUGO | S_IWUSR); S_IRUGO : S_IRUGO | S_IWUSR);
} }
} }
......
...@@ -371,7 +371,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, ...@@ -371,7 +371,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,
if (rhf_use_egr_bfr(packet->rhf)) if (rhf_use_egr_bfr(packet->rhf))
ebuf = packet->ebuf; ebuf = packet->ebuf;
if (ebuf == NULL) if (!ebuf)
goto drop; /* this should never happen */ goto drop; /* this should never happen */
if (lnh == HFI1_LRH_BTH) if (lnh == HFI1_LRH_BTH)
...@@ -402,7 +402,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd, ...@@ -402,7 +402,7 @@ static void rcv_hdrerr(struct hfi1_ctxtdata *rcd, struct hfi1_pportdata *ppd,
lqpn = be32_to_cpu(bth[1]) & RVT_QPN_MASK; lqpn = be32_to_cpu(bth[1]) & RVT_QPN_MASK;
rcu_read_lock(); rcu_read_lock();
qp = rvt_lookup_qpn(rdi, &ibp->rvp, lqpn); qp = rvt_lookup_qpn(rdi, &ibp->rvp, lqpn);
if (qp == NULL) { if (!qp) {
rcu_read_unlock(); rcu_read_unlock();
goto drop; goto drop;
} }
...@@ -637,7 +637,7 @@ static void __prescan_rxq(struct hfi1_packet *packet) ...@@ -637,7 +637,7 @@ static void __prescan_rxq(struct hfi1_packet *packet)
rcu_read_lock(); rcu_read_lock();
qp = rvt_lookup_qpn(rdi, &ibp->rvp, qpn); qp = rvt_lookup_qpn(rdi, &ibp->rvp, qpn);
if (qp == NULL) { if (!qp) {
rcu_read_unlock(); rcu_read_unlock();
goto next; goto next;
} }
......
...@@ -386,7 +386,7 @@ void set_link_ipg(struct hfi1_pportdata *ppd) ...@@ -386,7 +386,7 @@ void set_link_ipg(struct hfi1_pportdata *ppd)
cc_state = get_cc_state(ppd); cc_state = get_cc_state(ppd);
if (cc_state == NULL) if (!cc_state)
/* /*
* This should _never_ happen - rcu_read_lock() is held, * This should _never_ happen - rcu_read_lock() is held,
* and set_link_ipg() should not be called if cc_state * and set_link_ipg() should not be called if cc_state
...@@ -438,7 +438,7 @@ static enum hrtimer_restart cca_timer_fn(struct hrtimer *t) ...@@ -438,7 +438,7 @@ static enum hrtimer_restart cca_timer_fn(struct hrtimer *t)
cc_state = get_cc_state(ppd); cc_state = get_cc_state(ppd);
if (cc_state == NULL) { if (!cc_state) {
rcu_read_unlock(); rcu_read_unlock();
return HRTIMER_NORESTART; return HRTIMER_NORESTART;
} }
......
...@@ -3297,7 +3297,7 @@ static int __subn_get_opa_cong_setting(struct opa_smp *smp, u32 am, ...@@ -3297,7 +3297,7 @@ static int __subn_get_opa_cong_setting(struct opa_smp *smp, u32 am,
cc_state = get_cc_state(ppd); cc_state = get_cc_state(ppd);
if (cc_state == NULL) { if (!cc_state) {
rcu_read_unlock(); rcu_read_unlock();
return reply((struct ib_mad_hdr *)smp); return reply((struct ib_mad_hdr *)smp);
} }
...@@ -3439,7 +3439,7 @@ static int __subn_get_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data, ...@@ -3439,7 +3439,7 @@ static int __subn_get_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
cc_state = get_cc_state(ppd); cc_state = get_cc_state(ppd);
if (cc_state == NULL) { if (!cc_state) {
rcu_read_unlock(); rcu_read_unlock();
return reply((struct ib_mad_hdr *)smp); return reply((struct ib_mad_hdr *)smp);
} }
...@@ -3505,14 +3505,14 @@ static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data, ...@@ -3505,14 +3505,14 @@ static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data,
} }
new_cc_state = kzalloc(sizeof(*new_cc_state), GFP_KERNEL); new_cc_state = kzalloc(sizeof(*new_cc_state), GFP_KERNEL);
if (new_cc_state == NULL) if (!new_cc_state)
goto getit; goto getit;
spin_lock(&ppd->cc_state_lock); spin_lock(&ppd->cc_state_lock);
old_cc_state = get_cc_state(ppd); old_cc_state = get_cc_state(ppd);
if (old_cc_state == NULL) { if (!old_cc_state) {
spin_unlock(&ppd->cc_state_lock); spin_unlock(&ppd->cc_state_lock);
kfree(new_cc_state); kfree(new_cc_state);
return reply((struct ib_mad_hdr *)smp); return reply((struct ib_mad_hdr *)smp);
......
...@@ -2002,7 +2002,7 @@ int init_credit_return(struct hfi1_devdata *dd) ...@@ -2002,7 +2002,7 @@ int init_credit_return(struct hfi1_devdata *dd)
bytes, bytes,
&dd->cr_base[i].pa, &dd->cr_base[i].pa,
GFP_KERNEL); GFP_KERNEL);
if (dd->cr_base[i].va == NULL) { if (!dd->cr_base[i].va) {
set_dev_node(&dd->pcidev->dev, dd->node); set_dev_node(&dd->pcidev->dev, dd->node);
dd_dev_err(dd, dd_dev_err(dd,
"Unable to allocate credit return DMA range for NUMA %d\n", "Unable to allocate credit return DMA range for NUMA %d\n",
......
...@@ -2025,7 +2025,7 @@ void process_becn(struct hfi1_pportdata *ppd, u8 sl, u16 rlid, u32 lqpn, ...@@ -2025,7 +2025,7 @@ void process_becn(struct hfi1_pportdata *ppd, u8 sl, u16 rlid, u32 lqpn,
cc_state = get_cc_state(ppd); cc_state = get_cc_state(ppd);
if (cc_state == NULL) if (!cc_state)
return; return;
/* /*
......
...@@ -83,7 +83,7 @@ static ssize_t read_cc_table_bin(struct file *filp, struct kobject *kobj, ...@@ -83,7 +83,7 @@ static ssize_t read_cc_table_bin(struct file *filp, struct kobject *kobj,
rcu_read_lock(); rcu_read_lock();
cc_state = get_cc_state(ppd); cc_state = get_cc_state(ppd);
if (cc_state == NULL) { if (!cc_state) {
rcu_read_unlock(); rcu_read_unlock();
return -EINVAL; return -EINVAL;
} }
...@@ -130,7 +130,7 @@ static ssize_t read_cc_setting_bin(struct file *filp, struct kobject *kobj, ...@@ -130,7 +130,7 @@ static ssize_t read_cc_setting_bin(struct file *filp, struct kobject *kobj,
rcu_read_lock(); rcu_read_lock();
cc_state = get_cc_state(ppd); cc_state = get_cc_state(ppd);
if (cc_state == NULL) { if (!cc_state) {
rcu_read_unlock(); rcu_read_unlock();
return -EINVAL; return -EINVAL;
} }
......
...@@ -431,7 +431,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet) ...@@ -431,7 +431,7 @@ void hfi1_ib_rcv(struct hfi1_packet *packet)
if (lnh != HFI1_LRH_GRH) if (lnh != HFI1_LRH_GRH)
goto drop; goto drop;
mcast = rvt_mcast_find(&ibp->rvp, &hdr->u.l.grh.dgid); mcast = rvt_mcast_find(&ibp->rvp, &hdr->u.l.grh.dgid);
if (mcast == NULL) if (!mcast)
goto drop; goto drop;
list_for_each_entry_rcu(p, &mcast->qp_list, list) { list_for_each_entry_rcu(p, &mcast->qp_list, list) {
packet->qp = p->qp; packet->qp = p->qp;
...@@ -838,7 +838,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps, ...@@ -838,7 +838,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *qp, struct hfi1_pkt_state *ps,
if (cb) if (cb)
iowait_pio_inc(&priv->s_iowait); iowait_pio_inc(&priv->s_iowait);
pbuf = sc_buffer_alloc(sc, plen, cb, qp); pbuf = sc_buffer_alloc(sc, plen, cb, qp);
if (unlikely(pbuf == NULL)) { if (unlikely(!pbuf)) {
if (cb) if (cb)
verbs_pio_complete(qp, 0); verbs_pio_complete(qp, 0);
if (ppd->host_link_state != HLS_UP_ACTIVE) { if (ppd->host_link_state != HLS_UP_ACTIVE) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册