lkml.org 
[lkml]   [2022]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/9] device property: add index argument to property_read_string_array() callback
Le Fri, 25 Mar 2022 16:30:45 +0200,
Andy Shevchenko <andriy.shevchenko@linux.intel.com> a écrit :

> > pointer = property_entry_find(props, propname, length);
> > if (IS_ERR(pointer))
> > return PTR_ERR(pointer);
>
> > + if (index >= array_len)
> > + return -ENODATA;
>
> I was about to ask if we can check this before the
> property_entry_find() call, but realized that in such case it will
> shadow possible errors due to wrong or absent property.

I think you are actually right, the check can be done after
property_entry_count_elems_of_size() since it already checks for the
property to be present. I'll move that check.

>
> ...
>
> > - of_property_read_string_array(node, propname, val,
> > nval) :
> > + of_property_read_string_array_index(node,
> > propname, val, nval,
> > + index) :
>
> Dunno about the style there, but I think it can be one line.

Seems like the complete file is strictly applying the 80 columns rules
so I thought it was better to keep it like this. However, I think the
ternary oeprator is not really readable with such split.

--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

\
 
 \ /
  Last update: 2022-03-28 16:30    [W:0.532 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site