From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Ariel Elior <aelior@marvell.com>,
GR-everest-linux-l2@marvell.com,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net-next] qede: cleanup printing in qede_log_probe()
Date: Fri, 17 Sep 2021 16:46:28 +0300 [thread overview]
Message-ID: <20210917134628.GM2088@kadam> (raw)
In-Reply-To: <20210916081815.25ec31ad@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On Thu, Sep 16, 2021 at 08:18:15AM -0700, Jakub Kicinski wrote:
> On Thu, 16 Sep 2021 16:54:15 +0300 Dan Carpenter wrote:
> > This code use strlen(buf) to find the number of characters printed.
> > That's sort of ugly and unnecessary because we can just use the
> > return from scnprintf() instead.
> >
> > Also since strlen() does not count the NUL terminator, that means
> > "QEDE_FW_VER_STR_SIZE - strlen(buf)" is never going to be zero so
> > that condition can be removed.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > drivers/net/ethernet/qlogic/qede/qede_main.c | 9 ++++-----
> > 1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
> > index 9837bdb89cd4..e188ff5277a5 100644
> > --- a/drivers/net/ethernet/qlogic/qede/qede_main.c
> > +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
> > @@ -1087,9 +1087,9 @@ static void qede_log_probe(struct qede_dev *edev)
> > {
> > struct qed_dev_info *p_dev_info = &edev->dev_info.common;
> > u8 buf[QEDE_FW_VER_STR_SIZE];
> > - size_t left_size;
> > + int off;
> >
> > - snprintf(buf, QEDE_FW_VER_STR_SIZE,
> > + off = scnprintf(buf, QEDE_FW_VER_STR_SIZE,
> > "Storm FW %d.%d.%d.%d, Management FW %d.%d.%d.%d",
> > p_dev_info->fw_major, p_dev_info->fw_minor, p_dev_info->fw_rev,
> > p_dev_info->fw_eng,
>
> Why not adjust the continuation lines? checkpatch is not happy.
Sorry about that. I'll resend.
regards,
dan carpenter
prev parent reply other threads:[~2021-09-17 13:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 13:54 [PATCH net-next] qede: cleanup printing in qede_log_probe() Dan Carpenter
2021-09-16 15:18 ` Jakub Kicinski
2021-09-17 13:46 ` Dan Carpenter [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=20210917134628.GM2088@kadam \
--to=dan.carpenter@oracle.com \
--cc=GR-everest-linux-l2@marvell.com \
--cc=aelior@marvell.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.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).