lkml.org 
[lkml]   [2020]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/4] alarmtimer: Make alarmtimer platform device child of RTC device
Date
Doug Anderson <dianders@chromium.org> writes:
> On Thu, Jan 9, 2020 at 7:59 AM Stephen Boyd <swboyd@chromium.org> wrote:
>> diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
>> index 4b11f0309eee..ccb6aea4f1d4 100644
>> --- a/kernel/time/alarmtimer.c
>> +++ b/kernel/time/alarmtimer.c
>> @@ -88,6 +88,7 @@ static int alarmtimer_rtc_add_device(struct device *dev,
>> unsigned long flags;
>> struct rtc_device *rtc = to_rtc_device(dev);
>> struct wakeup_source *__ws;
>> + struct platform_device *pdev;
>> int ret = 0;
>>
>> if (rtcdev)
>> @@ -99,6 +100,7 @@ static int alarmtimer_rtc_add_device(struct device *dev,
>> return -1;
>>
>> __ws = wakeup_source_register(dev, "alarmtimer");
>> + pdev = platform_device_register_data(dev, "alarmtimer", -1, NULL, 0);
>
> Don't you need to check for an error here? If pdev is an error you'll
> continue on your merry way. Before your patch if you got an error
> registering the device it would have caused probe to fail.

Yes, that return value should be checked

> I guess you'd only want it to be an error if "rtcdev" is NULL?

If rtcdev is not NULL then this code is not reached. See the begin of
this function :)

Thanks,

tglx

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