From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtprelay0056.hostedemail.com ([216.40.44.56]:60023 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753292Ab3K0Ce1 (ORCPT ); Tue, 26 Nov 2013 21:34:27 -0500 Received: from smtprelay.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtpgrave08.hostedemail.com (Postfix) with ESMTP id CABD0212750 for ; Wed, 27 Nov 2013 02:27:29 +0000 (UTC) Message-ID: <1385519196.18487.25.camel@joe-AO722> Subject: Re: PCI: mvebu: return NULL instead of ERR_PTR(ret) From: Joe Perches To: Jingoo Han Cc: 'Christopher Li' , linux-sparse@vger.kernel.org, 'Dan Carpenter' , 'Jason Gunthorpe' , 'Jason Cooper' , 'Thomas Petazzoni' , 'Bjorn Helgaas' , linux-pci@vger.kernel.org, 'Ezequiel Garcia' , linux-arm-kernel@lists.infradead.org, 'Axel Lin' , 'Julia Lawall' Date: Tue, 26 Nov 2013 18:26:36 -0800 In-Reply-To: <000101ceeb14$480fee80$d82fcb80$%han@samsung.com> References: <001001ceb816$5d1aecc0$1750c640$%han@samsung.com> <20131125200256.GA7316@obsidianresearch.com> <001101ceea68$cb486220$61d92660$%han@samsung.com> <20131126180930.GC19852@obsidianresearch.com> <000101ceeb14$480fee80$d82fcb80$%han@samsung.com> Content-Type: text/plain; charset="ISO-8859-1" Mime-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org List-ID: On Wed, 2013-11-27 at 10:59 +0900, Jingoo Han wrote: [] > ./drivers/pci/host/pci-mvebu.c > static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev, > struct device_node *np, struct mvebu_pcie_port *port) > { > ..... > > ret = of_address_to_resource(np, 0, ®s); > if (ret) > - return ERR_PTR(ret); > + return (void __iomem *)ERR_PTR(ret); > > However, other engineers said that "(void __iomem *)ERR_PTR(ret)" > is not a general pattern. I cannot find the proper method to resolve > this sparse warning. > > In this case, how can I resolve this sparse warning? I think there's no problem using the cast. It's not a pattern because it's not been required before as function returns have not previously been declared __iomem. Or, perhaps the arm|hexagon specific #define below could be made generic so it could be used. arch/arm/include/asm/io.h:#define IOMEM(x) ((void __force __iomem *)(x)) return IOMEM(ERR_PTR(ret)); There aren't any current uses of return IOMEM(foo) either though so the direct cast is probably more appropriate.