Re: [PATCH v2] leds: pm8058: Silence pointer to integer size warning

From: Lee Jones
Date: Fri Dec 01 2017 - 03:56:09 EST


On Fri, 01 Dec 2017, Pavel Machek wrote:

> On Fri 2017-12-01 07:57:15, Lee Jones wrote:
> > On Thu, 30 Nov 2017, Bjorn Andersson wrote:
> > > - led->ledtype = (u32)of_device_get_match_data(&pdev->dev);
> > > + led->ledtype = (u32)(unsigned long)of_device_get_match_data(&pdev->dev);
> >
> > Wouldn't (u32)(void *) be even more correct?
> >
> > ... if the compiler will let you get away with it.
>
> Afaict that would still produce the warning. of_device_get_match_data
> already returns void *.

Just tested. It actually still suffers from the original error.

warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog