From patchwork Tue Dec 10 19:57:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 181156 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp6353007ile; Tue, 10 Dec 2019 11:58:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzHGP/yyIOl6nW44Ma0U7f1vxRKSFQWNwEclQtv4czZJCqxkQ/ReyOBtz7Cue/qZ1XG1X03 X-Received: by 2002:aca:f445:: with SMTP id s66mr514709oih.95.1576007894744; Tue, 10 Dec 2019 11:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576007894; cv=none; d=google.com; s=arc-20160816; b=oV2oRcGirK77HWS2Q/PmAc8oeOX+1VegP8ZMNbfOt5HORh0vPpO+c9R/2o3bRYbT00 i9iR7h+DJTFBxQgJ8fqido4OYGmTmNoQzF5aeGtcoITvclOZa3DKH07SY/JuBsDSEnLa nW3so/LmLrHskZeNfTHWAQXIKYX2ghYGgbHEEZApw0nspSjee8ShWturoDgnln2bZbgh /JDDDRCf3amOG5MUNuMqqtIy+UEViFzvD7h66sAqprHD+mirs0+bv6yPVbVCAQ9wcLnA 9N+KhCWZ/UbtkGehbGpjPvZ80+K49gf1Z3dhdELarD6X9mGVou5hmr8CriCHZcJTfwK7 Yzyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=S7Blm3KRluFebIeFKxpgtL+ElhZAL+m4c6C/afGrvVg=; b=fyLfh5xHk9gLQ4xWoCFyOYzxX1p5aRohJU8x42ml/6lPFf0p+yrov7pBn8yQ7ky7/C IJfEIhsx2yG0gZjWDQsZADearC3Bx8JfeM2j76B7eUINxBPv3IdLrcfMg8k4/RVsB5p7 5O0Himh6ekhbHro5UxcVPFcHBu2dqoNTzNdGfHRwuDJ+Ev05W+CQqZfOPQj/0CPzp9Yl 3SgOQph1jLYORo/RI00Trq61Lai4ll1MnsdjjDC/zZv/V0GkXRFmf0evh9SO9WVSRWA5 t5wDxh/NSkrHZdhRvvCo2PSxrtNuyqjrG5bBkyayiXm/R/wux6VMbip/P5YBxjVktx4x H+Bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h18si2747364otj.114.2019.12.10.11.58.14; Tue, 10 Dec 2019 11:58:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726881AbfLJT6N (ORCPT + 27 others); Tue, 10 Dec 2019 14:58:13 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:41215 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbfLJT6M (ORCPT ); Tue, 10 Dec 2019 14:58:12 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1M3lHZ-1idwhK3twp-000urC; Tue, 10 Dec 2019 20:58:06 +0100 From: Arnd Bergmann To: Christoph Hellwig , Joerg Roedel , Robin Murphy , Nicolas Saenz Julienne Cc: Arnd Bergmann , Tom Murphy , Julien Grall , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH] iommu: fix min_not_zero() type mismatch warning Date: Tue, 10 Dec 2019 20:57:56 +0100 Message-Id: <20191210195803.866126-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:V0PTrzRDmYv2osv56dZM7Vo+oE2UI7e/kklN8s5/0zdjDkWO6PK Syr2cpC870aQUfBxI/LQKX9UnQ52eZYLqOSd2qvQkBpN//NCWo0iM81Nxw+2YBrXdGcQ4RB pg0vsdCSmVp9qll1ByW2hslofn4NGZNapb5tmHEmAu28G2OCyKJQ2/VNjecSBSVvQ+huvVa bOG58DgSx5dcelzI2jpqw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:NXJLDdAXMEU=:NSSpjT2T1r5c0ziBNCNW/r 5vnGk8xhvaVmVr+eAbSykEY0l8MXV0Wx2rALNBcOoWZLDtTbils0slf3We/yHQ0rs7OGAsgYf 5BlmvFI+7ar5wj3br9ulKnVBH1vDniBmMjOmeTjw5BF/n83OaZw/FTW/VPkUBnGpCiYQwa1Bm TtbQRFXz1pB9U8xQASCg9cMF+tXDUpiL+wvTbvcLYmhg8FbgQbTcAmTx8R19l3DW4foPflf2J 7m+PywNID43s/9dvT18yzrYBJImDKwLg7zWCAgC0/dIgW7X2Xfl8TwuMZZti4aROTSOj5TbzL V//i43puiGW4XEntyk/qJzHB62ulXThNiQeIYgzwOJWK+0INVtjJoa7GYtf6I1Tt4cmA8Fc9z xf17zZt2tyfoPl6Sl/YzBTxoUMIOlnNwjYOSHmv/s8bmFg1glL7zuRxFtSdkwDuTzHKKLxk4P OVnL+x7WQUXg48TuZhF4KXwo2uD7dLYZf/gZZdq8KfjhgIt+T8NrPi3mydPt2+kHY2D/zqAu8 QN4FGFLqeKLlce1sU0SrUWhrhOPeBH06pkZR8YBLrnvBdR9exwt/T2okQ2SmxBG0/KZiAEwdt ODgDVfocrwulKZkzpuWKllnc7mpI8nJFeejNINauyVZVxqwjbSfLEqXxpTCOIlAgDEG91gpA5 pXgdP8WGTsOK2C4wPIF4wgFDaXpmPX3JdJ/IPRv9sJ2Wtysigw43HPuRfwR7vf6LFykoeABW7 HqP1mV1W5NEmJ08yjYYay3e8yVEpVCGDEx/Ra6f9NTK4FiRNRaOxRupAJsPwWjHncFdRIrG/r ZEH8CT6uQv3PclquS/i8WgYVHUM/WAVkYqVNjSsA+aV3RNVBXjAhyVc9C3JQskKFCHOpdvtef m75EGNB98XOtH3nYdf4Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org min()/max() require the arguments to be of the same type. When dma_addr_t is not compatible with __u64, this causes a warning: In file included from include/linux/list.h:9, from include/linux/kobject.h:19, from include/linux/of.h:17, from include/linux/irqdomain.h:35, from include/linux/acpi.h:13, from include/linux/acpi_iort.h:10, from drivers/iommu/dma-iommu.c:11: drivers/iommu/dma-iommu.c: In function 'iommu_dma_alloc_iova': include/linux/kernel.h:844:29: error: comparison of distinct pointer types lacks a cast [-Werror] (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) ^~ include/linux/kernel.h:858:4: note: in expansion of macro '__typecheck' (__typecheck(x, y) && __no_side_effects(x, y)) ^~~~~~~~~~~ include/linux/kernel.h:868:24: note: in expansion of macro '__safe_cmp' __builtin_choose_expr(__safe_cmp(x, y), \ ^~~~~~~~~~ include/linux/kernel.h:877:19: note: in expansion of macro '__careful_cmp' #define min(x, y) __careful_cmp(x, y, <) ^~~~~~~~~~~~~ include/linux/kernel.h:910:39: note: in expansion of macro 'min' __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); }) ^~~ drivers/iommu/dma-iommu.c:424:14: note: in expansion of macro 'min_not_zero' dma_limit = min_not_zero(dma_limit, dev->bus_dma_limit); ^~~~~~~~~~~~ Add an explicit cast to work around it, as there is no min_not_zero_t() equivalent of min_t(). Fixes: a7ba70f1787f ("dma-mapping: treat dev->bus_dma_mask as a DMA limit") Signed-off-by: Arnd Bergmann --- drivers/iommu/dma-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 0cc702a70a96..6fa32231dc9f 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -421,7 +421,7 @@ static dma_addr_t iommu_dma_alloc_iova(struct iommu_domain *domain, if (iova_len < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) iova_len = roundup_pow_of_two(iova_len); - dma_limit = min_not_zero(dma_limit, dev->bus_dma_limit); + dma_limit = min_not_zero((u64)dma_limit, dev->bus_dma_limit); if (domain->geometry.force_aperture) dma_limit = min(dma_limit, domain->geometry.aperture_end);