From: Loys Ollivier <lollivier@baylibre.com>
To: Robin Murphy <robin.murphy@arm.com>,
Johan Hovold <johan@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: baylibre-upstreaming@groups.io, linux-kernel@vger.kernel.org,
Corentin Labbe <clabbe.montjoie@gmail.com>,
linux-mediatek@lists.infradead.org,
Colin Ian King <colin.king@canonical.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] gnss: get serial speed from subdrivers
Date: Fri, 17 May 2019 10:45:53 +0200 [thread overview]
Message-ID: <86y33579ku.fsf@baylibre.com> (raw)
In-Reply-To: <69b5e90c-c1c3-9f2e-57a8-64741182a96e@arm.com>
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
WARNING: multiple messages have this Message-ID (diff)
From: Loys Ollivier <lollivier@baylibre.com>
To: Robin Murphy <robin.murphy@arm.com>,
Johan Hovold <johan@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>
Cc: baylibre-upstreaming@groups.io, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org,
Colin Ian King <colin.king@canonical.com>,
Corentin Labbe <clabbe.montjoie@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] gnss: get serial speed from subdrivers
Date: Fri, 17 May 2019 10:45:53 +0200 [thread overview]
Message-ID: <86y33579ku.fsf@baylibre.com> (raw)
In-Reply-To: <69b5e90c-c1c3-9f2e-57a8-64741182a96e@arm.com>
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-05-17 8:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 16:37 [PATCH v2] gnss: get serial speed from subdrivers Loys Ollivier
2019-05-16 16:37 ` Loys Ollivier
2019-05-16 18:02 ` Robin Murphy
2019-05-16 18:02 ` Robin Murphy
2019-05-17 8:45 ` Loys Ollivier [this message]
2019-05-17 8:45 ` Loys Ollivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86y33579ku.fsf@baylibre.com \
--to=lollivier@baylibre.com \
--cc=baylibre-upstreaming@groups.io \
--cc=clabbe.montjoie@gmail.com \
--cc=colin.king@canonical.com \
--cc=johan@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=robin.murphy@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.