Re: PCI: mvebu: return NULL instead of ERR_PTR(ret)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, &regs);
> 	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.


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux