From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756054AbdLOKfs (ORCPT ); Fri, 15 Dec 2017 05:35:48 -0500 Received: from mout.web.de ([212.227.15.3]:57646 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755018AbdLOKf0 (ORCPT ); Fri, 15 Dec 2017 05:35:26 -0500 Subject: [PATCH 2/7] rapidio: Adjust 12 checks for null pointers From: SF Markus Elfring To: kernel-janitors@vger.kernel.org, Alexandre Bounine , Matt Porter Cc: LKML References: Message-ID: <739f9f1c-3ebe-c21b-c5e2-31976cfbc0ee@users.sourceforge.net> Date: Fri, 15 Dec 2017 11:30:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:+zWJ7hx5B3Grurf5deox4nFdkeGpQA178FDv0P/alUhPrv1OY8Z zHZRHhNqZgELV6XuMEdz/7UiJnZkDa1lhR6IsqSZ/yFRm26RU4u+E2+FUstMzScjkLAejVI AyEpUumWn+poCTXsSSD1cuV9WuKOfhEMF2bHNkYf5954Uld+fmLAQFrUjLY++lkdCVtDUTb KIm8E9AhX0VTNgvlv9Ikw== X-UI-Out-Filterresults: notjunk:1;V01:K0:BvQUJvRlvcY=:IGcsI6p+KoekHESncMqSUj t7x2hy2mHGORoLdki31+1n2/ykGp2iWbEZVXmNpxozuwDkL+gaZML9wpQkCbFWL+BvfZ1FJGf ZDWUywOPHs0YwzvWNTlLVMvK9atC9vS1IZKRZutddS4AUpXdo11NzNJmhHYk/3HVpfpA6CNfB Ih7RGUY+fcq0atTEZrBgj7G1v6LL5ZtBTkVGprc1oDfy/805F3LJ0Iil/WW8hHXv4F6ljSgOl mPAg59TCqu/yamZwLH4Q0O37387JJ+54N97tzs+5AhrF5BggfA9AV02KfUS/QEf2h/XzWTb1m /R0naJR03uTQn03Zg7zs3nraRn6td4+IpO/VkgsvqDdC4HVGqo8ThrJZJ4AzbZmUla4bJMMT7 e6vPon1/8Nw1GlZnZyp8uuf8Qu8SsKLrd3f4qJ4fgyNhvCdnluMxeAuTcQwr22BrSr3bp2CQi bBlJcUATARtwNIA8Oa1S+HF8xT8j67Gr4MLFTnK5D5kNdUJ9DlZPmRfur02LxtOgugYZpJe1x eu1BTv/msH3x0ZsrDMAefwzpt6jptgeFyv6p9agZUT+UoBny5lPRu7Wpqc6SUmvBSeghhTMPh WjExQoze7mFNpc1brP94iuTzKYl1FWMHXya5ooXL8M6cvgw4CAcCLpTPr5wgRok3OxGiaCf0T y7BSyJ4W/1tVibP+5/Fg6OXBgXVY9uGfCYpaZUw+HXhTQPCUq5O5Xfd2nYnSTR/j8HoWWxfxD zplmAJZ15TGOFhJm00SZPIPdLFKxqFQsr1x8kjFKlpXenUc4jt0ZlQAaQRdHK+1v/HPiS/j5n tSlcO4SFujg4tWFPrGmnZgf7zhqYk38ksdJJNxDa7p9QxtWEZg= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Thu, 14 Dec 2017 15:27:07 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written … Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/rapidio/rio.c | 18 +++++++++--------- 1 file 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, int rc = -ENOSYS; struct resource *res; - if (mport->ops->open_inb_mbox == NULL) + if (!mport->ops->open_inb_mbox) goto out; res = kzalloc(sizeof(struct resource), GFP_KERNEL); @@ -326,7 +326,7 @@ int rio_request_outb_mbox(struct rio_mport *mport, int rc = -ENOSYS; struct resource *res; - if (mport->ops->open_outb_mbox == NULL) + if (!mport->ops->open_outb_mbox) goto out; res = kzalloc(sizeof(struct resource), GFP_KERNEL); @@ -632,7 +632,7 @@ int rio_request_inb_pwrite(struct rio_dev *rdev, int rc = 0; spin_lock(&rio_global_list_lock); - if (rdev->pwcback != NULL) + if (rdev->pwcback) rc = -ENOMEM; else rdev->pwcback = pwcback; @@ -975,7 +975,7 @@ rio_chk_dev_route(struct rio_dev *rdev, struct rio_dev **nrdev, int *npnum) rdev = rdev->prev; } - if (prev == NULL) + if (!prev) goto err_out; p_port = prev->rswitch->route_table[rdev->destid]; @@ -1054,7 +1054,7 @@ rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp) RIO_MNT_REQ_CMD_IS); /* Exit if the response is not expected */ - if (lnkresp == NULL) + if (!lnkresp) return 0; checkcount = 3; @@ -1696,7 +1696,7 @@ int rio_route_add_entry(struct rio_dev *rdev, spin_lock(&rdev->rswitch->lock); - if (ops == NULL || ops->add_entry == NULL) { + if (!ops || !ops->add_entry) { rc = rio_std_route_add_entry(rdev->net->hport, rdev->destid, rdev->hopcount, table, route_destid, route_port); @@ -1749,7 +1749,7 @@ int rio_route_get_entry(struct rio_dev *rdev, u16 table, spin_lock(&rdev->rswitch->lock); - if (ops == NULL || ops->get_entry == NULL) { + if (!ops || !ops->get_entry) { rc = rio_std_route_get_entry(rdev->net->hport, rdev->destid, rdev->hopcount, table, route_destid, route_port); @@ -1797,7 +1797,7 @@ int rio_route_clr_table(struct rio_dev *rdev, u16 table, int lock) spin_lock(&rdev->rswitch->lock); - if (ops == NULL || ops->clr_table == NULL) { + if (!ops || !ops->clr_table) { rc = rio_std_route_clr_table(rdev->net->hport, rdev->destid, rdev->hopcount, table); } else if (try_module_get(ops->owner)) { @@ -1889,7 +1889,7 @@ struct dma_async_tx_descriptor *rio_dma_prep_xfer(struct dma_chan *dchan, { struct rio_dma_ext rio_ext; - if (dchan->device->device_prep_slave_sg == NULL) { + if (!dchan->device->device_prep_slave_sg) { pr_err("%s: prep_rio_sg == NULL\n", __func__); return NULL; } -- 2.15.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: SF Markus Elfring Date: Fri, 15 Dec 2017 10:30:15 +0000 Subject: [PATCH 2/7] rapidio: Adjust 12 checks for null pointers Message-Id: <739f9f1c-3ebe-c21b-c5e2-31976cfbc0ee@users.sourceforge.net> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: kernel-janitors@vger.kernel.org, Alexandre Bounine , Matt Porter Cc: LKML From: Markus Elfring Date: Thu, 14 Dec 2017 15:27:07 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written … Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/rapidio/rio.c | 18 +++++++++--------- 1 file 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, int rc = -ENOSYS; struct resource *res; - if (mport->ops->open_inb_mbox = NULL) + if (!mport->ops->open_inb_mbox) goto out; res = kzalloc(sizeof(struct resource), GFP_KERNEL); @@ -326,7 +326,7 @@ int rio_request_outb_mbox(struct rio_mport *mport, int rc = -ENOSYS; struct resource *res; - if (mport->ops->open_outb_mbox = NULL) + if (!mport->ops->open_outb_mbox) goto out; res = kzalloc(sizeof(struct resource), GFP_KERNEL); @@ -632,7 +632,7 @@ int rio_request_inb_pwrite(struct rio_dev *rdev, int rc = 0; spin_lock(&rio_global_list_lock); - if (rdev->pwcback != NULL) + if (rdev->pwcback) rc = -ENOMEM; else rdev->pwcback = pwcback; @@ -975,7 +975,7 @@ rio_chk_dev_route(struct rio_dev *rdev, struct rio_dev **nrdev, int *npnum) rdev = rdev->prev; } - if (prev = NULL) + if (!prev) goto err_out; p_port = prev->rswitch->route_table[rdev->destid]; @@ -1054,7 +1054,7 @@ rio_get_input_status(struct rio_dev *rdev, int pnum, u32 *lnkresp) RIO_MNT_REQ_CMD_IS); /* Exit if the response is not expected */ - if (lnkresp = NULL) + if (!lnkresp) return 0; checkcount = 3; @@ -1696,7 +1696,7 @@ int rio_route_add_entry(struct rio_dev *rdev, spin_lock(&rdev->rswitch->lock); - if (ops = NULL || ops->add_entry = NULL) { + if (!ops || !ops->add_entry) { rc = rio_std_route_add_entry(rdev->net->hport, rdev->destid, rdev->hopcount, table, route_destid, route_port); @@ -1749,7 +1749,7 @@ int rio_route_get_entry(struct rio_dev *rdev, u16 table, spin_lock(&rdev->rswitch->lock); - if (ops = NULL || ops->get_entry = NULL) { + if (!ops || !ops->get_entry) { rc = rio_std_route_get_entry(rdev->net->hport, rdev->destid, rdev->hopcount, table, route_destid, route_port); @@ -1797,7 +1797,7 @@ int rio_route_clr_table(struct rio_dev *rdev, u16 table, int lock) spin_lock(&rdev->rswitch->lock); - if (ops = NULL || ops->clr_table = NULL) { + if (!ops || !ops->clr_table) { rc = rio_std_route_clr_table(rdev->net->hport, rdev->destid, rdev->hopcount, table); } else if (try_module_get(ops->owner)) { @@ -1889,7 +1889,7 @@ struct dma_async_tx_descriptor *rio_dma_prep_xfer(struct dma_chan *dchan, { struct rio_dma_ext rio_ext; - if (dchan->device->device_prep_slave_sg = NULL) { + if (!dchan->device->device_prep_slave_sg) { pr_err("%s: prep_rio_sg = NULL\n", __func__); return NULL; } -- 2.15.1