Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756832AbdLOQiT (ORCPT ); Fri, 15 Dec 2017 11:38:19 -0500 Received: from mout.web.de ([212.227.15.4]:54443 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932519AbdLOQiF (ORCPT ); Fri, 15 Dec 2017 11:38:05 -0500 Subject: [PATCH 3/3] rapidio: tsi721_dma: Adjust six checks for null pointers From: SF Markus Elfring To: kernel-janitors@vger.kernel.org, Alexandre Bounine , Matt Porter Cc: LKML References: <33c63b12-7828-891a-31ef-76a2e3c6b90c@users.sourceforge.net> Message-ID: Date: Fri, 15 Dec 2017 17:37:32 +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: <33c63b12-7828-891a-31ef-76a2e3c6b90c@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:JodnUA7LJg+KC3zpT3D+svr682821gRKcImw5pfR/V2mAZLWhMl Dapxpkj5TRz/Xl1b4gYPjVuyCMu6dAJ+WoEIBsekzmVwBDl6kkI0Io213X8WDgN/aJFYB+5 NKqxyw9I4H0YiL0wRcx5QnUROHaDCy63jx+o98aTislrzYDP9AVEJTsFjdBaKaHUxMJKdr8 2rGaEst/SBn0Q/iEcyH2w== X-UI-Out-Filterresults: notjunk:1;V01:K0:E3yG2W85srg=:h+6zviis2d+vR2tEKygkeT pt7TRwdxCjpYRPIi9vomcGjCvZOSHm/z/mx4ArJuS7LzvqJutc6RgAv70sLag3mgiVOw7Rf7j KDHUUW9P9uAj7rvJOPO2N62UbTuari+uj3RefupqKHIVtDFnHr7CpC7rrQTslKef/NrB24f5R vqlu5ZT6LW+enQlSHZQH+LeaQLRJ84xphUDSvsUzkg/Ty+7hI4kogcrCsxJCxZ/HOj1GVBnWC lo89cYhOeiMgdhDgvxXI0wwSmkZwi+xtmp2q0XEX1RY1te/kY4IayAh2zWDL7RucurXUPxKYW s1gz+232qD2CdBt5bK2lm1csi4yy20KrPnt7AbhpS7LL5iDxuI+pKlvRqQSnT15A1qW4zMha/ VH+TIFTOtlM6CLZVdcsrV9uCAOEHiNWMHyJ8bCAeH12cF+LdRFiijhIKennTcwDTCqMhexAmA 62xIYQccquWlW8KhQcc+ERkpeiDYsdYUMp/fhSgtOIAdA3jJVScB6E2I1aE3Rt8hFBSFKtS2Z azQaBPPpS69Nf5l0CjvNMObIOXXsZWZEK7/Nxg2ZNS05QbHhPYRH2Gmr0N701+GKJhDpSrqxa e7Qebd8gVipEBXkjaNBpPoxDGLLr4bXGF7k1iM7dnqt8ciRq7/S6V9CECcy2Ya4xNdYEllDL6 DgJl1fcaD+Gqpovl2ZQUnhVGj9ms4TOH6hWWKlKqkE2EFwDRmmuYrfdU98wpsTsiC9CQlNe8P +oq8t9xkhzXw7ck8la+LdmaSgBEqE/AXOjaEqxbJxeOqx0YjY8BLjTXWvpAedWyDJZaXTF7UF IjjMQ0vAlj6xlRbi7HUa6z2ycNKe4nXpjee1wqPoI95p5la+C0Kl8O0xFK3F8OGxlqEy7ld Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2220 Lines: 70 From: Markus Elfring Date: Fri, 15 Dec 2017 14:35:21 +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/devices/tsi721_dma.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/rapidio/devices/tsi721_dma.c b/drivers/rapidio/devices/tsi721_dma.c index 14fc36ac3d85..006ea5a45020 100644 --- a/drivers/rapidio/devices/tsi721_dma.c +++ b/drivers/rapidio/devices/tsi721_dma.c @@ -222,7 +222,7 @@ static int tsi721_bdma_ch_free(struct tsi721_bdma_chan *bdma_chan) struct tsi721_device *priv = to_tsi721(bdma_chan->dchan.device); #endif - if (bdma_chan->bd_base == NULL) + if (!bdma_chan->bd_base) return 0; /* Check if DMA channel still running */ @@ -346,7 +346,7 @@ tsi721_desc_fill_init(struct tsi721_tx_desc *desc, { u64 rio_addr; - if (bd_ptr == NULL) + if (!bd_ptr) return -EINVAL; /* Initialize DMA descriptor */ @@ -370,7 +370,7 @@ tsi721_desc_fill_init(struct tsi721_tx_desc *desc, static int tsi721_desc_fill_end(struct tsi721_dma_desc *bd_ptr, u32 bcount, bool interrupt) { - if (bd_ptr == NULL) + if (!bd_ptr) return -EINVAL; /* Update DMA descriptor */ @@ -555,9 +555,7 @@ static void tsi721_advance_work(struct tsi721_bdma_chan *bdma_chan, * If there is no data transfer in progress, fetch new descriptor from * the pending queue. */ - - if (desc == NULL && bdma_chan->active_tx == NULL && - !list_empty(&bdma_chan->queue)) { + if (!desc && !bdma_chan->active_tx && !list_empty(&bdma_chan->queue)) { desc = list_first_entry(&bdma_chan->queue, struct tsi721_tx_desc, desc_node); list_del_init((&desc->desc_node)); @@ -796,7 +794,7 @@ static void tsi721_free_chan_resources(struct dma_chan *dchan) tsi_debug(DMA, &dchan->dev->device, "DMAC%d", bdma_chan->id); - if (bdma_chan->bd_base == NULL) + if (!bdma_chan->bd_base) return; tsi721_bdma_interrupt_enable(bdma_chan, 0); -- 2.15.1