From patchwork Sun Apr 23 09:09:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9694617 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 16FF0601E9 for ; Sun, 23 Apr 2017 09:09:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AA7327F94 for ; Sun, 23 Apr 2017 09:09:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF73C280DE; Sun, 23 Apr 2017 09:09:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A72B426E56 for ; Sun, 23 Apr 2017 09:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1044335AbdDWJJa (ORCPT ); Sun, 23 Apr 2017 05:09:30 -0400 Received: from mout.web.de ([212.227.15.3]:51024 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1044180AbdDWJJ2 (ORCPT ); Sun, 23 Apr 2017 05:09:28 -0400 Received: from [192.168.1.2] ([77.182.27.214]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LsyBm-1c0zlK3nTu-012XUS; Sun, 23 Apr 2017 11:09:21 +0200 Subject: [PATCH 2/2] dmaengine: k3dma: Adjust six checks for null pointers From: SF Markus Elfring To: dmaengine@vger.kernel.org, Dan Williams , Vinod Koul , Zhangfei Gao Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <12cb50fb-63b7-8127-700d-1fe1c75c3961@users.sourceforge.net> Date: Sun, 23 Apr 2017 11:09:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:lOkAkxNKKsZJZedqc19kChuj8pu/u5hYufRIDgs6X0/bhw1RRbR g1jK3o8Uk8i5J9WTx89UL86Fge7O7zrqUqF/pEiFvW4Wwe1c3xVxEEPERZYkH2NluT6Ecx1 IFON3j65CAyjoJZKrVlvyipSqi1qUcKNBTQXkZLOg33lkl7DTB4mmMTXmLCO+fL64sGfZb4 WpKckt2XywyJ9xatplevQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:wPVcPNQ6xU4=:0o3nLTL73xZvViRnaAoU/l nn+Hp2fLMonAF0EW7qgjyrEARj5mxRXolRfY4BPYungksjIVJQYIp4HNq7xpDIh8W4m5a/LEp Q72aKyi1qFYVPOI7ETnGSTLNFDaTY1SypPPxqpM/UkTpJUiECbSkQk5e29nnKp8HfWFdiixf5 /5pY3qCf7co2nVPRYek7fP4EEvHMaANCWh1hB3ItCiPXg65SN2K3Zs9P4t/q5tCvZq+M0qevi z30FyFkG6jmIOnjGw5ChlHcwQHZlu6SQ/AJ9hLSzJ2EdzKN6bitI/6q9Ld334WpRdyAjkC8s5 VoU69tL9udHQaz2ahEbM2h/vav0l8/A4Oc2X/NhHdrXPgGGOq5N/OnmRGPqppmQvdWR7OVmM5 lxm3uB9K8+spWq3Lf+RnOw0dqSkZTk8TVZvvXb8LcF9N7Zz7eueopgRTtjZ6kx9xqMhI8B8LX Ou8mRiaj2Ka1Jr76OHqNvyEezcuCWTazvoDiq2zPz0JKu9mFyhjiuHX9ACoEwpJXIaKaQ2BuL FedLnc9EmlpDrKe+LXNLK7MDVDa6jd9XndR6i5jGD2Q3Naaxi0M+cgfWCXlWeevbFLjlK9D/O 2r5u0nX9ek7j2XSovO41DQAioDm49aPA7+jE/o99BwIP/it67uQCU8kZCQ1Wfuu/z/RenWS5e QOWt1kHt51a7o8Tvw3lJQqKo4gE7/aS9Z0mCfUcxaJ1P2jjSjjrxVgAmdmgr1FwsqCt+MzATi fPkTOwvxnd7O7o8EmVQG3FlXJZEsKz/yreWmFP7QhNHkpj+DVNEEXYfK+ZPPUzhfkRr9M1FH0 kfKAMMH Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 23 Apr 2017 10:47:04 +0200 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/dma/k3dma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index 31a51ee1a910..da20565f7a8d 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c @@ -230,7 +230,7 @@ static irqreturn_t k3_dma_int_handler(int irq, void *dev_id) } if (c && (tc2 & BIT(i))) { spin_lock_irqsave(&c->vc.lock, flags); - if (p->ds_run != NULL) + if (p->ds_run) vchan_cyclic_callback(&p->ds_run->vd); spin_unlock_irqrestore(&c->vc.lock, flags); } @@ -312,7 +312,7 @@ static void k3_dma_tasklet(unsigned long arg) for (pch = 0; pch < d->dma_channels; pch++) { p = &d->phy[pch]; - if (p->vchan == NULL && !list_empty(&d->chan_pending)) { + if (!p->vchan && !list_empty(&d->chan_pending)) { c = list_first_entry(&d->chan_pending, struct k3_dma_chan, node); /* remove from d->chan_pending */ @@ -527,7 +527,7 @@ static struct dma_async_tx_descriptor *k3_dma_prep_slave_sg( dma_addr_t addr, src = 0, dst = 0; int num = sglen, i; - if (sgl == NULL) + if (!sgl) return NULL; c->cyclic = 0; @@ -645,7 +645,7 @@ static int k3_dma_config(struct dma_chan *chan, u32 maxburst = 0, val = 0; enum dma_slave_buswidth width = DMA_SLAVE_BUSWIDTH_UNDEFINED; - if (cfg == NULL) + if (!cfg) return -EINVAL; c->dir = cfg->direction; if (c->dir == DMA_DEV_TO_MEM) { @@ -847,7 +847,7 @@ static int k3_dma_probe(struct platform_device *op) /* init phy channel */ d->phy = devm_kcalloc(&op->dev, d->dma_channels, sizeof(*d->phy), GFP_KERNEL); - if (d->phy == NULL) + if (!d->phy) return -ENOMEM; for (i = 0; i < d->dma_channels; i++) { @@ -877,7 +877,7 @@ static int k3_dma_probe(struct platform_device *op) /* init virtual channel */ d->chans = devm_kcalloc(&op->dev, d->dma_requests, sizeof(*d->chans), GFP_KERNEL); - if (d->chans == NULL) + if (!d->chans) return -ENOMEM; for (i = 0; i < d->dma_requests; i++) {