summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2018-02-06 18:39:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-06 21:32:46 -0500
commit93dd49afc27b72cc621b3d9c2ff86052db9c8222 (patch)
treec808301535d080c6bbf66ebfea12912378b835fa
parent0c5afcade39550a6af1185535e1b6c547e76ff79 (diff)
rapidio: adjust 12 checks for null pointers
checkpatch pointed information out like the following. Comparison to NULL could be written ... Thus fix the affected source code places. Link: http://lkml.kernel.org/r/739f9f1c-3ebe-c21b-c5e2-31976cfbc0ee@users.sourceforge.net Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Alexandre Bounine <alexandre.bounine@idt.com> Cc: Matt Porter <mporter@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/rapidio/rio.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index 032ede23a8cb..f89085564c2c 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -243,7 +243,7 @@ int rio_request_inb_mbox(struct rio_mport *mport,
243 int rc = -ENOSYS; 243 int rc = -ENOSYS;
244 struct resource *res; 244 struct resource *res;
245 245
246 if (mport->ops->open_inb_mbox == NULL) 246 if (!mport->ops->open_inb_mbox)
247 goto out; 247 goto out;
248 248
249 res = kzalloc(sizeof(struct resource), GFP_KERNEL); 249 res = kzalloc(sizeof(struct resource), GFP_KERNEL);
@@ -326,7 +326,7 @@ int rio_request_outb_mbox(struct rio_mport *mport,
326 int rc = -ENOSYS; 326 int rc = -ENOSYS;
327 struct resource *res; 327 struct resource *res;
328 328
329 if (mport->ops->open_outb_mbox == NULL) 329 if (!mport->ops->open_outb_mbox)
330 goto out; 330 goto out;
331 331
332 res = kzalloc(sizeof(struct resource), GFP_KERNEL); 332 res = kzalloc(sizeof(struct resource), GFP_KERNEL);
@@ -632,7 +632,7 @@ int rio_request_inb_pwrite(struct rio_dev *rdev,
632 int rc = 0; 632 int rc = 0;
633 633
634 spin_lock(&rio_global_list_lock); 634 spin_lock(&rio_global_list_lock);
635 if (rdev->pwcback != NULL) 635 if (rdev->pwcback)
636 rc = -ENOMEM; 636 rc = -ENOMEM;
637 else 637 else
638 rdev->pwcback = pwcback; 638 rdev->pwcback = pwcback;
@@ -975,7 +975,7 @@ rio_chk_dev_route(struct rio_dev *rdev, struct rio_dev **nrdev, int *npnum)
975 rdev = rdev->prev; 975 rdev = rdev->prev;
976 } 976 }
977 977
978 if (prev == NULL) 978 if (!prev)
979 goto err_out; 979 goto err_out;
980 980
981 p_port = prev->rswitch->route_table[rdev->destid]; 981 p_port = prev->rswitch->route_table[rdev->destid];
@@ -1054,7 +1054,7 @@ rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp)
1054 RIO_MNT_REQ_CMD_IS); 1054 RIO_MNT_REQ_CMD_IS);
1055 1055
1056 /* Exit if the response is not expected */ 1056 /* Exit if the response is not expected */
1057 if (lnkresp == NULL) 1057 if (!lnkresp)
1058 return 0; 1058 return 0;
1059 1059
1060 checkcount = 3; 1060 checkcount = 3;
@@ -1696,7 +1696,7 @@ int rio_route_add_entry(struct rio_dev *rdev,
1696 1696
1697 spin_lock(&rdev->rswitch->lock); 1697 spin_lock(&rdev->rswitch->lock);
1698 1698
1699 if (ops == NULL || ops->add_entry == NULL) { 1699 if (!ops || !ops->add_entry) {
1700 rc = rio_std_route_add_entry(rdev->net->hport, rdev->destid, 1700 rc = rio_std_route_add_entry(rdev->net->hport, rdev->destid,
1701 rdev->hopcount, table, 1701 rdev->hopcount, table,
1702 route_destid, route_port); 1702 route_destid, route_port);
@@ -1749,7 +1749,7 @@ int rio_route_get_entry(struct rio_dev *rdev, u16 table,
1749 1749
1750 spin_lock(&rdev->rswitch->lock); 1750 spin_lock(&rdev->rswitch->lock);
1751 1751
1752 if (ops == NULL || ops->get_entry == NULL) { 1752 if (!ops || !ops->get_entry) {
1753 rc = rio_std_route_get_entry(rdev->net->hport, rdev->destid, 1753 rc = rio_std_route_get_entry(rdev->net->hport, rdev->destid,
1754 rdev->hopcount, table, 1754 rdev->hopcount, table,
1755 route_destid, route_port); 1755 route_destid, route_port);
@@ -1797,7 +1797,7 @@ int rio_route_clr_table(struct rio_dev *rdev, u16 table, int lock)
1797 1797
1798 spin_lock(&rdev->rswitch->lock); 1798 spin_lock(&rdev->rswitch->lock);
1799 1799
1800 if (ops == NULL || ops->clr_table == NULL) { 1800 if (!ops || !ops->clr_table) {
1801 rc = rio_std_route_clr_table(rdev->net->hport, rdev->destid, 1801 rc = rio_std_route_clr_table(rdev->net->hport, rdev->destid,
1802 rdev->hopcount, table); 1802 rdev->hopcount, table);
1803 } else if (try_module_get(ops->owner)) { 1803 } else if (try_module_get(ops->owner)) {
@@ -1889,7 +1889,7 @@ struct dma_async_tx_descriptor *rio_dma_prep_xfer(struct dma_chan *dchan,
1889{ 1889{
1890 struct rio_dma_ext rio_ext; 1890 struct rio_dma_ext rio_ext;
1891 1891
1892 if (dchan->device->device_prep_slave_sg == NULL) { 1892 if (!dchan->device->device_prep_slave_sg) {
1893 pr_err("%s: prep_rio_sg == NULL\n", __func__); 1893 pr_err("%s: prep_rio_sg == NULL\n", __func__);
1894 return NULL; 1894 return NULL;
1895 } 1895 }