From: Hans de Goede <hdegoede@redhat.com>
To: Marcel Holtmann <marcel@holtmann.org>,
Jiecheng Wu <jasonwood2031@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] hci_bcm.c: fix missing return value check of devm_clk_get()
Date: Tue, 21 Aug 2018 16:49:13 +0200 [thread overview]
Message-ID: <0115b7d3-3c45-62dd-ffb4-33659e276335@redhat.com> (raw)
In-Reply-To: <B67E0AC3-9761-4DF0-A382-AA5900C1577A@holtmann.org>
Hi,
On 21-08-18 16:38, Marcel Holtmann wrote:
> Hi Jiecheng,
>
>> Function bcm_get_resources() defined in drivers/bluetooth/hci_bcm.c calls devm_clk_get() that may return an error code. The return value of function bcm_get_resources() should be checked whether it is an error code.
>> ---
>> drivers/bluetooth/hci_bcm.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
>> index ddbd8c6..f4089a2 100644
>> --- a/drivers/bluetooth/hci_bcm.c
>> +++ b/drivers/bluetooth/hci_bcm.c
>> @@ -906,6 +906,8 @@ static int bcm_get_resources(struct bcm_device *dev)
>> return 0;
>>
>> dev->clk = devm_clk_get(dev->dev, NULL);
>> + if (IS_ERR(dev->clk))
>> + return PTR_ERR(dev->clk);
>
> is this really needed? I assume it all fails gracefully.
This is not necessary, this will actually break things on x86 since
we don't have a clk to get there, all future references
to dev->clk are protected like this:
if (powered && !IS_ERR(dev->clk) && !dev->clk_enabled) {
Notice the !IS_ERR(dev->clk), this is there exactly because
hci_bcm.c's use of the clk is optional, and this patch would break
that, so NACK.
Regards,
Hans
prev parent reply other threads:[~2018-08-21 14:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-18 2:06 [PATCH] hci_bcm.c: fix missing return value check of devm_clk_get() Jiecheng Wu
2018-08-21 14:38 ` Marcel Holtmann
2018-08-21 14:49 ` Hans de Goede [this message]
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=0115b7d3-3c45-62dd-ffb4-33659e276335@redhat.com \
--to=hdegoede@redhat.com \
--cc=jasonwood2031@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).