lkml.org 
[lkml]   [2012]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH can-next v4] can: add tx/rx LED trigger support
On 08/01/2012 12:30 PM, Fabio Baltieri wrote:
[...]
>>> +void can_led_init(struct net_device *netdev)
>>> +{
>>> + struct can_priv *priv = netdev_priv(netdev);
>>> + void *res;
>>> +
>>> + res = devres_alloc(can_led_release, 0, GFP_KERNEL);
>> ^
>> I'm not really sure if this is working. For example, pinctrl [1]
>> allocates a double pointer here. The res pointer here and in
>> can_led_release simply points to invalid memory. But as long as you
>> don't dereference it, it should work.
>>
>> [1] http://lxr.free-electrons.com/source/drivers/pinctrl/core.c#L862
>
> Actually that's also used by libata-core (not in lxr yet) and dma-mapping:
>
> http://lxr.free-electrons.com/source/drivers/base/dma-mapping.c#L193
>
> actually, res should point at the end of some internal devres structure,
> and is only used as return value in this case.
>
> Of course, in this case the release function can only use the struct
> device pointer.
>
> I've run some fail test and ftraced the whole thing and it seems to work
> pretty good! I'll send a v5 with the rename later.

Thanks for checking. I just noticed, the pinctrl usecase is a bit different.

Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-08-01 14:21    [W:0.117 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site