Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6838058ybi; Mon, 22 Jul 2019 02:34:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUj5Ybl05JnmWzKCwIbE1y9wCWcVTsTBai5IL+bRJOc3rF6Sxcc82FllTYd+71/aG11VlD X-Received: by 2002:a17:90a:26e4:: with SMTP id m91mr76300519pje.93.1563788060973; Mon, 22 Jul 2019 02:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563788060; cv=none; d=google.com; s=arc-20160816; b=qU9Q3i1XPzJ1l5IoumrMriGhoFJ06+/NUqCvjsBw8TL4mfjr1Hz894HHdun3c/1V+F OYT9pnjnFUozEhW1nPhHLkrcyw/uFXUElBZV+FmAyJvTztxuBlz7huT7wmh1vUf7BAfE ceNpbWctQi5I/Uy1opQmIGT1B8wIztUpOIgKrVyvWuLU5z/BZa2jt2Y+vbtu6hpit0FP atBoxblAGXfEKxwYIS/aNkyNqx2xFBzNw9j/axua+v3nB9Z8LLNmflFu5R0vsFOQ8Lr6 0yUm36PgwmS1r0p2wxdNxB7KQkHKJGWvmEabHXAmUp//z8tCbUmVWVk1S4uUXEIQIYUE k64A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=A41vVwkBcqafClv/qQ/TY/EKBujHF6FwAS4WziIh2J4=; b=k0vXXT9/4dov08eGxs5Iaplj+LUwBrY67AOM7UDk2FuvBG7w+Ir199mNBkuPSIxDU7 yuhlOEn+3Uu06uPejJJtRCRgfQXuhfHyRijWGHwiDz7ln/ER+J4m8uL/wdkWdWwKUJ/7 MAdxZapGJfZkkWpIzmU5Jt6W/AOTlcT8+k0EwyW+vlCT8535EJPmPCQN1ysnG6EY+Nce FaEqCLSpopoVwbVMKpvdG2RkliS6n6alze7HIGfgDb9cb8dl9ZvTrvYtqKjl4ftexygM wqpKl3RQHlLKahshadg3IaIe4yDVxk5qfYRZFrcIqKB8JQR7NYn1zFPdikB5xxw2Zf6J liyw== 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 s17si8273175pfc.237.2019.07.22.02.34.04; Mon, 22 Jul 2019 02:34:20 -0700 (PDT) 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 S1728148AbfGVIi6 (ORCPT + 99 others); Mon, 22 Jul 2019 04:38:58 -0400 Received: from ns.iliad.fr ([212.27.33.1]:48734 "EHLO ns.iliad.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfGVIi6 (ORCPT ); Mon, 22 Jul 2019 04:38:58 -0400 Received: from ns.iliad.fr (localhost [127.0.0.1]) by ns.iliad.fr (Postfix) with ESMTP id 3001C20598; Mon, 22 Jul 2019 10:38:56 +0200 (CEST) Received: from [192.168.108.49] (freebox.vlq16.iliad.fr [213.36.7.13]) by ns.iliad.fr (Postfix) with ESMTP id 188EA200A6; Mon, 22 Jul 2019 10:38:56 +0200 (CEST) Subject: Re: [PATCH] firmware: qcom_scm: fix error for incompatible pointer To: Minwoo Im , MSM , LKML Cc: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Rob Clark , Stephen Boyd , Christoph Hellwig References: <20190719134303.7617-1-minwoo.im.dev@gmail.com> From: Marc Gonzalez Message-ID: <7ea51e42-ab8a-e4e2-1833-651e2dabca3c@free.fr> Date: Mon, 22 Jul 2019 10:38:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190719134303.7617-1-minwoo.im.dev@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP ; ns.iliad.fr ; Mon Jul 22 10:38:56 2019 +0200 (CEST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding people who have worked on drivers/firmware/qcom_scm.c or DMA On 19/07/2019 15:43, Minwoo Im wrote: > The following error can happen when trying to build it: > > ``` > drivers/firmware/qcom_scm.c: In function ‘qcom_scm_assign_mem’: > drivers/firmware/qcom_scm.c:460:47: error: passing argument 3 of ‘dma_alloc_coherent’ from incompatible pointer type [-Werror=incompatible-pointer-types] > ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL); > ^ > In file included from drivers/firmware/qcom_scm.c:12:0: > ./include/linux/dma-mapping.h:636:21: note: expected ‘dma_addr_t * {aka long long unsigned int *}’ but argument is of type ‘phys_addr_t * {aka unsigned int *}’ > static inline void *dma_alloc_coherent(struct device *dev, size_t size, > ^~~~~~~~~~~~~~~~~~ > ``` > > We just can cast phys_addr_t to dma_addr_t here. IME, casting is rarely a proper solution. > diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c > index 2ddc118dba1b..7f6c841fa200 100644 > --- a/drivers/firmware/qcom_scm.c > +++ b/drivers/firmware/qcom_scm.c > @@ -457,7 +457,8 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, > ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) + > ALIGN(dest_sz, SZ_64); > > - ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL); > + ptr = dma_alloc_coherent(__scm->dev, ptr_sz, (dma_addr_t *) &ptr_phys, > + GFP_KERNEL); > if (!ptr) > return -ENOMEM; >