Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2291984imm; Thu, 27 Sep 2018 10:21:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV61oijfHNOeby01IFUhTc869ialdqG+r4FYLioosYjN8bLsmulJUhzaa73giWu83hEdYDnGD X-Received: by 2002:a62:fc13:: with SMTP id e19-v6mr12616755pfh.101.1538068872174; Thu, 27 Sep 2018 10:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538068872; cv=none; d=google.com; s=arc-20160816; b=bxjVOrSkjWRJ3irx7YQlyJXQ/8oE09OAwvv/SoImpA0VHywc10d8HVPRymesVNww3o hWOJXX3zIh0MAa16ed6Ydfa3703lWYfJOebuAzPVdT7JJcaE9aEKfy+S+GQAaZncfuy6 QvEDxKq9rNTgYZ1kRoadvMbes76HyDOukXzRH8pZBzdIFKr5GrWXEVJR8fJS03teGL1R UhztLMcN1veY6DYjpfecokN5puxLEjJHXlMP2aXP/KBUpNjm5FUkG3zS1LN1yAftSSFE NUvyeK1KbEUcWW2DPlbEYgHI/EXSnNU2QbM6Xj2DndGaNMdysecuIelErEsH2BLhyGQo pC7w== 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:reply-to; bh=eBOmtlKBY3qU5GQZl39N63xIfn0SufpTXxm0GcaxbYw=; b=qmlq+Y8mYkpD2ViEQCWsqapuUDWOXPD8ALHKp0jr6ipHjQEfzdIVMa8zvmyV2xq4JX Yp2d8+RPu4mKCdjudqFvB7zaLL4v9nGza3LRkA9T7do2h1bkleIh+CLLsxl1Z6DTKkfI MDE7TsR4tljq89uhDJpc+Ekd7qYsDkfLiOH+V9+d8UvkEuAL0ovg3q/qoD7cWswwW5JC ochtIGWwQtKGYXXSjUPWTTL+uuH/4b/pzAp0/d2f4u8u1BaaRoR8HkYkFI8far6d9GDd yo6SMjKlTFFEHtop6Wvhqlv6xGjCCaV7+QrA1N7vhJI5cdBU/BT3IGM4e6xxbTkVWxJA 2Sfg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12-v6si2302535pla.403.2018.09.27.10.20.55; Thu, 27 Sep 2018 10:21:12 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728089AbeI0Xj6 (ORCPT + 99 others); Thu, 27 Sep 2018 19:39:58 -0400 Received: from mga04.intel.com ([192.55.52.120]:43564 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727338AbeI0Xj6 (ORCPT ); Thu, 27 Sep 2018 19:39:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2018 10:20:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,311,1534834800"; d="scan'208";a="236559983" Received: from tthayer-hp-z620.an.intel.com (HELO [10.122.105.132]) ([10.122.105.132]) by orsmga004.jf.intel.com with ESMTP; 27 Sep 2018 10:20:39 -0700 Reply-To: thor.thayer@linux.intel.com Subject: Re: [PATCH] EDAC, altera: work around int-to-pointer-cast warnings To: Arnd Bergmann , Borislav Petkov , Mauro Carvalho Chehab Cc: David Frey , Mark Rutland , Ingo Molnar , Christophe JAILLET , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180927100949.973078-1-arnd@arndb.de> From: Thor Thayer Message-ID: <2d52e197-8ce0-e428-fb1a-e118a840fa12@linux.intel.com> Date: Thu, 27 Sep 2018 12:23:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180927100949.973078-1-arnd@arndb.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, On 09/27/2018 05:09 AM, Arnd Bergmann wrote: > The altera edac driver passes a token from a DT resource as > resource_size_t into an SMC call, but casts it to an __iomem pointer > and then a plain void pointer inbetween, mixing three or four > incompatible types in the process. The compiler complains about > one of the conversions: > > drivers/edac/altera_edac.c: In function 'altr_init_a10_ecc_block': > drivers/edac/altera_edac.c:1053:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] > base = (void __iomem *)res.start; > ^ > drivers/edac/altera_edac.c: In function 'altr_edac_a10_probe': > drivers/edac/altera_edac.c:2062:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] > base = (void __iomem *)res.start; > > Using a static checker probably also notices the __iomem cast. Solving > this properly isn't trivial, but simply casting to a 'uintptr_t' instead > of 'void __iomem *' makes it less wrong and should avoid the warnings. > > Fixes: d5fc9125566c ("EDAC, altera: Combine Stratix10 and Arria10 probe functions") > Signed-off-by: Arnd Bergmann > --- > drivers/edac/altera_edac.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c > index 0e9e80789d99..c89d82aa2776 100644 > --- a/drivers/edac/altera_edac.c > +++ b/drivers/edac/altera_edac.c > @@ -1036,7 +1036,7 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask, > } else { > struct device_node *sysmgr_np; > struct resource res; > - void __iomem *base; > + uintptr_t base; > > sysmgr_np = of_parse_phandle(np_eccmgr, > "altr,sysmgr-syscon", 0); > @@ -1050,9 +1050,9 @@ altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask, > return -ENOMEM; > > /* Need physical address for SMCC call */ > - base = (void __iomem *)res.start; > + base = res.start; > > - ecc_mgr_map = regmap_init(NULL, NULL, base, > + ecc_mgr_map = regmap_init(NULL, NULL, (void *)base, > &s10_sdram_regmap_cfg); > } > of_node_put(np_eccmgr); > @@ -2045,7 +2045,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev) > } else { > struct device_node *sysmgr_np; > struct resource res; > - void __iomem *base; > + uintptr_t base; > > sysmgr_np = of_parse_phandle(pdev->dev.of_node, > "altr,sysmgr-syscon", 0); > @@ -2059,9 +2059,10 @@ static int altr_edac_a10_probe(struct platform_device *pdev) > return -ENOMEM; > > /* Need physical address for SMCC call */ > - base = (void __iomem *)res.start; > + base = res.start; > > - edac->ecc_mgr_map = devm_regmap_init(&pdev->dev, NULL, base, > + edac->ecc_mgr_map = devm_regmap_init(&pdev->dev, NULL, > + (void *)base, > &s10_sdram_regmap_cfg); > } > Thanks for the fix. Reviewed-by: Thor Thayer