From patchwork Mon Jan 21 11:26:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 10773721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52555746 for ; Mon, 21 Jan 2019 11:26:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F06429CA6 for ; Mon, 21 Jan 2019 11:26:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 331E729CA9; Mon, 21 Jan 2019 11:26:36 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 D4A3929CA6 for ; Mon, 21 Jan 2019 11:26:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728216AbfAUL03 (ORCPT ); Mon, 21 Jan 2019 06:26:29 -0500 Received: from foss.arm.com ([217.140.101.70]:60138 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727679AbfAUL03 (ORCPT ); Mon, 21 Jan 2019 06:26:29 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1348AEBD; Mon, 21 Jan 2019 03:26:29 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.197.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B08883F5C1; Mon, 21 Jan 2019 03:26:27 -0800 (PST) From: Andre Przywara To: Vinod Koul Cc: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lucas Stach , Baruch Siach Subject: [PATCH] dma: imx: Fix arm64 compilation issue due to min() size issue Date: Mon, 21 Jan 2019 11:26:22 +0000 Message-Id: <20190121112622.127542-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Compiling the i.MX DMA driver for arm64 results in a warning due to imxdma_desc->len being a size_t, while scatterlist->len being an uint: drivers/dma/imx-dma.c: In function ‘imxdma_sg_next’: /src/linux/include/linux/kernel.h:846:29: warning: comparison of distinct pointer types lacks a cast (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ... drivers/dma/imx-dma.c:288:8: note: in expansion of macro ‘min’ now = min(d->len, sg_dma_len(sg)); ^~~ I am not sure if size_t is the right type for len in the first place, but anyway the fix is pretty simple. This fixes compiling an arm64 kernel with i.MX (DMA) support enabled. Signed-off-by: Andre Przywara --- Hi, apologies if this has been sent already (just ignore it then), but I couldn't find anything quickly enough. I see this since -rc1, but it's still annoying me in -rc3, hence this patch. Cheers, Andre. drivers/dma/imx-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index c2fff3f6c9ca..fa3ef43fe314 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -285,7 +285,7 @@ static inline int imxdma_sg_next(struct imxdma_desc *d) struct scatterlist *sg = d->sg; unsigned long now; - now = min(d->len, sg_dma_len(sg)); + now = min_t(size_t, d->len, sg_dma_len(sg)); if (d->len != IMX_DMA_LENGTH_LOOP) d->len -= now;