[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <546C9319.4040205@bfs.de>
Date: Wed, 19 Nov 2014 13:54:49 +0100
From: walter harms <wharms@....de>
To: Dan Carpenter <dan.carpenter@...cle.com>
CC: SF Markus Elfring <elfring@...rs.sourceforge.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
"Rafael J. Wysocki" <rjw@...ysocki.net>, linux-pm@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 1/1] PM-wakeup: Deletion of an unnecessary check before
the function call "wakeup_source_unregister"
Am 19.11.2014 13:09, schrieb Dan Carpenter:
> On Wed, Nov 19, 2014 at 12:26:45PM +0100, SF Markus Elfring wrote:
>> --- a/drivers/base/power/wakeup.c
>> +++ b/drivers/base/power/wakeup.c
>> @@ -267,8 +267,7 @@ int device_wakeup_disable(struct device *dev)
>> return -EINVAL;
>>
>> ws = device_wakeup_detach(dev);
>> - if (ws)
>> - wakeup_source_unregister(ws);
>> + wakeup_source_unregister(ws);
>
> In the original code, it's clear that the programmer thought about what
> happens when the device_wakeup_detach() returns NULL but in the new code
> that's not clear.
>
> I guess the information is still there in the git archive, but why hide
> the good code by covering it with confusing code?
>
hi,
just to add an other point of view ...
device_wakeup_detach returns dev->power.wakeup what is never NULL in this case.
(not visible here but a few line before exactly this is checked)
so this code can be compacted to:
wakeup_source_unregister(device_wakeup_detach(dev));
--readability
let the maintainer decide this byte-saving vs readability
re,
wh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists