lkml.org 
[lkml]   [2023]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [lvc-project] [PATCH] iio: chemical: scd30: Add check for NULL in scd30_i2c_command
From
Date
On 13.01.2023 21:47, Andy Shevchenko wrote:
> On Fri, Jan 13, 2023 at 8:41 PM Alexey Khoroshilov
> <khoroshilov@ispras.ru> wrote:
>> On 13.01.2023 16:33, Anastasia Belova wrote:
>
>> It seems it is better to put the whole validation loop under if (rsp)
>> check.
>
> No. The entire patch is redundant.
> The code that calls this function is under the control of the same
> driver, so we know how to avoid shooting in our foot.

I see, there is an assumption that response is NULL iff size is zero.

May be it could be documented, because naming of arguments does not make
such assumption obvious for fresh readers.

--
Thank you,
Alexey

\
 
 \ /
  Last update: 2023-03-26 23:41    [W:0.040 / U:1.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site