From patchwork Tue May 23 00:25:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 9741561 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 75AA860210 for ; Tue, 23 May 2017 00:25:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61DDA2873D for ; Tue, 23 May 2017 00:25:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 551B028770; Tue, 23 May 2017 00:25:54 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E8E882873D for ; Tue, 23 May 2017 00:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=8nFeMFCML2F2caE4dyGMqjbpjKkPpa+2VqZZZUWXeTU=; b=XAiNkC6QuZLtMy cuBX7Kh+K5Yvgom1KYzp5thoTOm6TQ69OYlyEq+HcCRX/0y2Ly2rn/qsDEqIA/fP3Mw4oyw5J84Bj Vryxulrv4cCI9yUKYqzw0KLA4Wny5ut3hk0nd3jZw7PNURZUDtw15l2PFtXMXQQ+6hgI6q+EUBZg4 mLjlhxvvedW9l05qfv7s94Bv7Z3VenOEmm3jqc2kTI7MI2wuILRkonVutqoIt16jPsz9qVEPqE1ml do8sFNAao67SIDJO0xKFuyOslpL7Q2Un/i9vXOTDQ93uspVfRUHwKNm+Qiq0/601Y32RFIwDjuOXL c4uaNhgA51BSqDevBWDA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dCxdz-0001hH-6g; Tue, 23 May 2017 00:25:47 +0000 Received: from gateway33.websitewelcome.com ([192.185.145.9]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dCxdw-0001fU-Er for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2017 00:25:46 +0000 Received: from cm4.websitewelcome.com (unknown [108.167.139.16]) by gateway33.websitewelcome.com (Postfix) with ESMTP id EA45C594EA for ; Mon, 22 May 2017 19:25:09 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cm4.websitewelcome.com with id PcR81v0160V9LXg01cR9pA; Mon, 22 May 2017 19:25:09 -0500 Received: from [189.152.160.17] (port=59336 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.87) (envelope-from ) id 1dCxdM-0000Eo-I5; Mon, 22 May 2017 19:25:08 -0500 Date: Mon, 22 May 2017 19:25:07 -0500 From: "Gustavo A. R. Silva" To: Kukjin Kim , Krzysztof Kozlowski , Andi Shyti , Mark Brown Subject: [PATCH] spi: add null check before pointer dereference Message-ID: <20170523002507.GA16670@embeddedgus> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.152.160.17 X-Exim-ID: 1dCxdM-0000Eo-I5 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.160.17]:59336 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 5 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170522_172544_555405_4D5AD1CD X-CRM114-Status: UNSURE ( 6.79 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add null check before dereferencing pointer desc Addresses-Coverity-ID: 1397997 Signed-off-by: Gustavo A. R. Silva --- drivers/spi/spi-s3c64xx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index b392cca..9f1013e 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -306,6 +306,12 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, desc = dmaengine_prep_slave_sg(dma->ch, sgt->sgl, sgt->nents, dma->direction, DMA_PREP_INTERRUPT); + if (!desc) { + dev_err(&sdd->master->dev, + "%s:dmaengine_prep_slave_sg Failed\n", __func__); + return; + } + desc->callback = s3c64xx_spi_dmacb; desc->callback_param = dma;