lkml.org 
[lkml]   [2012]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3 v2] iio: add rtc-driver for HID sensors of type time
On Tue, 11 Dec 2012 01:01:29 +0100
Alexander Holler <holler@ahsoftware.de> wrote:

> Am 10.12.2012 23:36, schrieb Lars-Peter Clausen:
> > Well, I've been exaggerating a bit, you can call it multiple times, but you
>
> Thanks a lot for the explanation(s).
>
> >>>> +error_free_drvdata:
> >>>> + platform_set_drvdata(pdev, NULL);
> >>>
> >>> Setting the platform data to NULL should not be necessary. Some
> >>> drivers do
> >>> this but it's kind of the result of cargo-cult-coding.
> >>>
> >>>> + kfree(time_state);
>
> Btw. I wouldn't call that cargo-cult-coding. It's more defensive
> programming as people might not be sure, if there is something around
> which still might access the platform data at that point. Ok, there
> would be a need for a mutex or similiar if that really could happen, but
> I wouldn't call such practices cargo-cult. ;)

Agreed - pointer NULLing catches a lot of mistakes during teardown where
timers or interrupts running in parallel get missed.

Alan


\
 
 \ /
  Last update: 2012-12-11 12:01    [W:0.088 / U:0.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site