提交 47bc1697 编写于 作者: I Ira Weiny 提交者: Greg Kroah-Hartman

staging/rdma/hfi1: diag.c change null comparisons

Use !foo rather than (foo == NULL) as recommended by checkpatch --strict
Signed-off-by: NIra Weiny <ira.weiny@intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 be98b87f
...@@ -571,7 +571,7 @@ static ssize_t diagpkt_write(struct file *fp, const char __user *data, ...@@ -571,7 +571,7 @@ static ssize_t diagpkt_write(struct file *fp, const char __user *data,
*/ */
if (dp.pbc) { if (dp.pbc) {
dd = hfi1_lookup(dp.unit); dd = hfi1_lookup(dp.unit);
if (dd == NULL) if (!dd)
return -ENODEV; return -ENODEV;
vl = (dp.pbc >> PBC_VL_SHIFT) & PBC_VL_MASK; vl = (dp.pbc >> PBC_VL_SHIFT) & PBC_VL_MASK;
sc = dd->vld[vl].sc; sc = dd->vld[vl].sc;
...@@ -657,7 +657,7 @@ static int hfi1_snoop_open(struct inode *in, struct file *fp) ...@@ -657,7 +657,7 @@ static int hfi1_snoop_open(struct inode *in, struct file *fp)
mutex_lock(&hfi1_mutex); mutex_lock(&hfi1_mutex);
dd = hfi1_dd_from_sc_inode(in); dd = hfi1_dd_from_sc_inode(in);
if (dd == NULL) { if (!dd) {
ret = -ENODEV; ret = -ENODEV;
goto bail; goto bail;
} }
...@@ -744,7 +744,7 @@ static int hfi1_snoop_release(struct inode *in, struct file *fp) ...@@ -744,7 +744,7 @@ static int hfi1_snoop_release(struct inode *in, struct file *fp)
int mode_flag; int mode_flag;
dd = hfi1_dd_from_sc_inode(in); dd = hfi1_dd_from_sc_inode(in);
if (dd == NULL) if (!dd)
return -ENODEV; return -ENODEV;
spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags);
...@@ -799,7 +799,7 @@ static unsigned int hfi1_snoop_poll(struct file *fp, ...@@ -799,7 +799,7 @@ static unsigned int hfi1_snoop_poll(struct file *fp,
struct hfi1_devdata *dd; struct hfi1_devdata *dd;
dd = hfi1_dd_from_sc_inode(fp->f_inode); dd = hfi1_dd_from_sc_inode(fp->f_inode);
if (dd == NULL) if (!dd)
return -ENODEV; return -ENODEV;
spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags);
...@@ -826,7 +826,7 @@ static ssize_t hfi1_snoop_write(struct file *fp, const char __user *data, ...@@ -826,7 +826,7 @@ static ssize_t hfi1_snoop_write(struct file *fp, const char __user *data,
struct hfi1_pportdata *ppd; struct hfi1_pportdata *ppd;
dd = hfi1_dd_from_sc_inode(fp->f_inode); dd = hfi1_dd_from_sc_inode(fp->f_inode);
if (dd == NULL) if (!dd)
return -ENODEV; return -ENODEV;
ppd = dd->pport; ppd = dd->pport;
...@@ -924,7 +924,7 @@ static ssize_t hfi1_snoop_read(struct file *fp, char __user *data, ...@@ -924,7 +924,7 @@ static ssize_t hfi1_snoop_read(struct file *fp, char __user *data,
struct hfi1_devdata *dd; struct hfi1_devdata *dd;
dd = hfi1_dd_from_sc_inode(fp->f_inode); dd = hfi1_dd_from_sc_inode(fp->f_inode);
if (dd == NULL) if (!dd)
return -ENODEV; return -ENODEV;
spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags);
...@@ -982,7 +982,7 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) ...@@ -982,7 +982,7 @@ static long hfi1_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
struct hfi1_link_info link_info; struct hfi1_link_info link_info;
dd = hfi1_dd_from_sc_inode(fp->f_inode); dd = hfi1_dd_from_sc_inode(fp->f_inode);
if (dd == NULL) if (!dd)
return -ENODEV; return -ENODEV;
spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags); spin_lock_irqsave(&dd->hfi1_snoop.snoop_lock, flags);
...@@ -1546,7 +1546,7 @@ int snoop_recv_handler(struct hfi1_packet *packet) ...@@ -1546,7 +1546,7 @@ int snoop_recv_handler(struct hfi1_packet *packet)
tlen - header_size, tlen - header_size,
md_len); md_len);
if (unlikely(s_packet == NULL)) { if (unlikely(!s_packet)) {
dd_dev_warn_ratelimited(ppd->dd, "Unable to allocate snoop/capture packet\n"); dd_dev_warn_ratelimited(ppd->dd, "Unable to allocate snoop/capture packet\n");
break; break;
} }
...@@ -1667,7 +1667,7 @@ int snoop_send_pio_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps, ...@@ -1667,7 +1667,7 @@ int snoop_send_pio_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,
/* not using ss->total_len as arg 2 b/c that does not count CRC */ /* not using ss->total_len as arg 2 b/c that does not count CRC */
s_packet = allocate_snoop_packet(hdr_len, tlen - hdr_len, md_len); s_packet = allocate_snoop_packet(hdr_len, tlen - hdr_len, md_len);
if (unlikely(s_packet == NULL)) { if (unlikely(!s_packet)) {
dd_dev_warn_ratelimited(ppd->dd, "Unable to allocate snoop/capture packet\n"); dd_dev_warn_ratelimited(ppd->dd, "Unable to allocate snoop/capture packet\n");
goto out; goto out;
} }
...@@ -1836,7 +1836,7 @@ void snoop_inline_pio_send(struct hfi1_devdata *dd, struct pio_buf *pbuf, ...@@ -1836,7 +1836,7 @@ void snoop_inline_pio_send(struct hfi1_devdata *dd, struct pio_buf *pbuf,
s_packet = allocate_snoop_packet(packet_len, 0, md_len); s_packet = allocate_snoop_packet(packet_len, 0, md_len);
if (unlikely(s_packet == NULL)) { if (unlikely(!s_packet)) {
dd_dev_warn_ratelimited(dd, "Unable to allocate snoop/capture packet\n"); dd_dev_warn_ratelimited(dd, "Unable to allocate snoop/capture packet\n");
goto inline_pio_out; goto inline_pio_out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册