lkml.org 
[lkml]   [2015]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] regulator: wm831x-dcdc: Use pointer after NULL check
Hello charles,
>> pdata is used before NULL check, so it looks misleading.
>> If pdata validation is required then we have to
>> first check for pdata validation, then calculate id,
>> and then second check for pdata->dcdc[id].
>>
>> and it is better to use !pointer than (pointer == NULL)
>>
>> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
>> ---

>The patch basically looks fine, but it feels a bit like needless
>churn. The current code is perfectly correct and feels clear
>enough to me.

Reason for patch is we are checking a pointer which is already dereferenced
before NULL check, which looks misleading.
If we know code is working correctly, Then we may simply drop NULL check,
rather than these changes.

Thanks,
Maninder
........
\
 
 \ /
  Last update: 2015-07-02 13:21    [W:0.031 / U:2.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site