From patchwork Tue Jun 13 20:56:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olav Haugan X-Patchwork-Id: 9784657 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 4F23A602C9 for ; Tue, 13 Jun 2017 20:56:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F9D6283AD for ; Tue, 13 Jun 2017 20:56:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 345A8285BF; Tue, 13 Jun 2017 20:56:58 +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 B8ED5283AD for ; Tue, 13 Jun 2017 20:56:57 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From: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=zO0A6+xmiVfD6sk5yQqC58W+vaYzTk4eTZ7r0xRQOKw=; b=tv8 Ur7OODIK6tQbSaeRxqgJO0H34Mk9Zv7YD/mLBOHEwawexHi5yMWwm+mLMqPY7vn3J6E/mWvldW2WT +GXvg8dmqv+sgJPqv1j+7XUrT4v3iHz89a10Qb1z9XjtR97k61HppUWXK/dPSfipTAje9xQ+8q8jJ GsPd0mLlqWCiQjFISIUuOwyWQtZcQaUJqe7S3TSgvGrsRf6/D1emuiPjF/qhxrJhL4c8OR8ZA5xmH Zdpv4qJZYUWDEjULUPSasGp7/BymQ6Pk4hAJscXL2FsUeLr4ZOmfpOpOd2zoF8RDh3I9gMkjxI/5i c7IUeCCjLiZg+8HAwxGJB6G+L6LYBBQ==; 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 1dKsrw-00016b-Hf; Tue, 13 Jun 2017 20:56:56 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dKsrs-00014H-Ph for linux-arm-kernel@lists.infradead.org; Tue, 13 Jun 2017 20:56:54 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E2C00607CC; Tue, 13 Jun 2017 20:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1497387388; bh=C3LU9Cj0btF+lAO0YsZIDuaKbyXyLTrlByUBDoerhZM=; h=From:To:Cc:Subject:Date:From; b=UAlV3ksr+pWOolBIAHUbdxv9y432qvnvkHeAjXXb5HVEXjkJIaqm1gF7fSNmiXgKY epL65keBEfXFxSdZVZXcBE0ZBvxp4tfwG8mb9m6U2YdjLiPJQ2qlWvMv1J/y7GChIT hOEQL+EyguzNtG1MSeFJU8EYwqE8CtLpgKzk4Fw0= Received: from ohaugan-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ohaugan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 18A5260711; Tue, 13 Jun 2017 20:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1497387388; bh=C3LU9Cj0btF+lAO0YsZIDuaKbyXyLTrlByUBDoerhZM=; h=From:To:Cc:Subject:Date:From; b=UAlV3ksr+pWOolBIAHUbdxv9y432qvnvkHeAjXXb5HVEXjkJIaqm1gF7fSNmiXgKY epL65keBEfXFxSdZVZXcBE0ZBvxp4tfwG8mb9m6U2YdjLiPJQ2qlWvMv1J/y7GChIT hOEQL+EyguzNtG1MSeFJU8EYwqE8CtLpgKzk4Fw0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 18A5260711 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ohaugan@codeaurora.org From: Olav Haugan To: ohaugan@codeaurora.org, catalin.marinas@arm.com, will.deacon@arm.com, robin.murphy@arm.com Subject: [PATCH v2] arm64/dma-mapping: Remove extraneous null-pointer checks Date: Tue, 13 Jun 2017 13:56:14 -0700 Message-Id: <20170613205614.15872-1-ohaugan@codeaurora.org> X-Mailer: git-send-email 2.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170613_135652_899374_3F681696 X-CRM114-Status: GOOD ( 10.13 ) 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-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 The current null-pointer check in __dma_alloc_coherent and __dma_free_coherent is not needed anymore since the __dma_alloc/__dma_free functions won't be called if !dev (dummy ops will be called instead). Signed-off-by: Olav Haugan Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/dma-mapping.h | 2 -- arch/arm64/mm/dma-mapping.c | 9 --------- 2 files changed, 11 deletions(-) diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 5392dbeffa45..f72779aad276 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -48,8 +48,6 @@ void arch_teardown_dma_ops(struct device *dev); /* do not use this function in a driver */ static inline bool is_device_dma_coherent(struct device *dev) { - if (!dev) - return false; return dev->archdata.dma_coherent; } diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 3216e098c058..3e340b625436 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -95,11 +95,6 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) { - if (dev == NULL) { - WARN_ONCE(1, "Use an actual device structure for DMA allocation\n"); - return NULL; - } - if (IS_ENABLED(CONFIG_ZONE_DMA) && dev->coherent_dma_mask <= DMA_BIT_MASK(32)) flags |= GFP_DMA; @@ -128,10 +123,6 @@ static void __dma_free_coherent(struct device *dev, size_t size, bool freed; phys_addr_t paddr = dma_to_phys(dev, dma_handle); - if (dev == NULL) { - WARN_ONCE(1, "Use an actual device structure for DMA allocation\n"); - return; - } freed = dma_release_from_contiguous(dev, phys_to_page(paddr),