From: Abhishek Kumar <kuabhs@chromium.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Kalle Valo <kvalo@codeaurora.org>,
ath10k <ath10k@lists.infradead.org>,
Rakesh Pillai <pillair@codeaurora.org>,
linux-wireless <linux-wireless@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Kalle Valo <kvalo@kernel.org>,
netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] ath10k: search for default BDF name provided in DT
Date: Thu, 13 Jan 2022 22:50:45 -0800 [thread overview]
Message-ID: <CACTWRwsT8dEPiVkvk_=FPSAwuN2oti27p8Vb-mVjWE7iJuTNrw@mail.gmail.com> (raw)
In-Reply-To: <CAD=FV=VVzQFK_PwnCXkJ6OK3DcgBnoxmvNG3WXFn30ncdY-E_w@mail.gmail.com>
On Mon, Jan 10, 2022 at 4:51 PM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Mon, Jan 10, 2022 at 3:15 PM Abhishek Kumar <kuabhs@chromium.org> wrote:
> >
> > +int ath10k_core_parse_default_bdf_dt(struct ath10k *ar)
> > +{
> > + struct device_node *node;
> > + const char *board_name = NULL;
> > +
> > + ar->id.default_bdf[0] = '\0';
> > +
> > + node = ar->dev->of_node;
> > + if (!node)
> > + return -ENOENT;
> > +
> > + of_property_read_string(node, "qcom,ath10k-default-bdf",
> > + &board_name);
> > + if (!board_name)
> > + return -ENODATA;
> > +
> > + if (strscpy(ar->id.default_bdf,
> > + board_name, sizeof(ar->id.default_bdf)) < 0)
> > + ath10k_warn(ar,
> > + "default board name is longer than allocated buffer, board_name: %s; allocated size: %ld\n",
> > + board_name, sizeof(ar->id.default_bdf));
>
> I suspect, but don't know for sure, that you're going to get another
> builder splat here. Just like sizeof() isn't guaranteed to return an
> "unsigned int", it's also not guaranteed to return an "unsigned long".
> I believe you want %zu. See Documentation/core-api/printk-formats.rst
Thanks for the tip, I will make this fix in V3.
>
> > +
> > + return 0;
> > +}
> > +EXPORT_SYMBOL(ath10k_core_parse_default_bdf_dt);
>
> Boy, that function seems like overkill for something that you need
> once at init time. ...and I also suspect that the lifetime of the
> string returned by of_property_read_string() is valid for as long as
> your "of_node" is held and thus probably you could use it directly (it
> likely has a longer lifetime than the location you're storing it).
>
> ...but I guess it matches the ath10k_core_check_dt() function above
> it, so I guess it's fine?
Ya, that was my idea to match it with ath10k_core_check_dt, initially,
I was planning to remodify ath10k_core_check_dt to parse the new
property, but looks it is used it multiple places, so I thought having
a separate parser function would be cleaner, however, I am open to new
ideas.
- Abhishek
next prev parent reply other threads:[~2022-01-14 6:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 23:14 [PATCH v2 1/2] ath10k: search for default BDF name provided in DT Abhishek Kumar
2022-01-10 23:14 ` [PATCH v2 2/2] dt: bindings: add dt entry for ath10k default BDF name Abhishek Kumar
2022-01-12 2:21 ` Rob Herring
2022-01-11 0:51 ` [PATCH v2 1/2] ath10k: search for default BDF name provided in DT Doug Anderson
2022-01-14 6:50 ` Abhishek Kumar [this message]
2022-01-11 1:07 ` kernel test robot
2022-01-14 6:47 ` Abhishek Kumar
2022-01-14 14:46 ` Kalle Valo
2022-03-08 0:50 ` Doug Anderson
2022-03-10 10:07 ` Kalle Valo
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='CACTWRwsT8dEPiVkvk_=FPSAwuN2oti27p8Vb-mVjWE7iJuTNrw@mail.gmail.com' \
--to=kuabhs@chromium.org \
--cc=ath10k@lists.infradead.org \
--cc=davem@davemloft.net \
--cc=dianders@chromium.org \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pillair@codeaurora.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 read-only IMAP folder(s) and NNTP newsgroup(s).