lkml.org 
[lkml]   [2019]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2] gnss: get serial speed from subdrivers
Date
On Thu 16 May 2019 at 19:02, Robin Murphy <robin.murphy@arm.com> wrote:

>> -/*
>> - * FIXME: need to provide subdriver defaults or separate dt parsing from
>> - * allocation.
>> - */
>> static int gnss_serial_parse_dt(struct serdev_device *serdev)
>> {
>> struct gnss_serial *gserial = serdev_device_get_drvdata(serdev);
>> struct device_node *node = serdev->dev.of_node;
>> - u32 speed = 4800;
>> + u32 speed;
>>
>> - of_property_read_u32(node, "current-speed", &speed);
>> + of_property_read_u32(node, "default-speed", &speed);
>>
>> gserial->speed = speed;
>
> Hmm, maybe it's a bit too convoluted for the compiler to warn about, but
> if a "default-speed" property is not present, gserial->speed will now be
> assigned an uninitialised value. I don't know what the intent is neither
> the driver nor the DT provides a value, but you'll either need to bring
> back the fallback initialisation above or propagate errors from
> of_property_read_u32().
>
> Robin.
>

Robin,
Good point, thank you for your review. I'll think about it and see about
a fallback scenario.
I would be in favour of propagating the error because default values are
very dependent on the hardware in use.

Best,

Loys

\
 
 \ /
  Last update: 2019-05-17 10:46    [W:0.033 / U:11.532 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site