From: Felipe Balbi <felipe.balbi@linux.intel.com>
To: Jack Pham <jackp@codeaurora.org>
Cc: Linux USB <linux-usb@vger.kernel.org>
Subject: [2/2] usb: dwc3: debug: purge usage of strcat
Date: Wed, 06 Feb 2019 08:29:48 +0200 [thread overview]
Message-ID: <87r2clmntv.fsf@linux.intel.com> (raw)
Hi,
Jack Pham <jackp@codeaurora.org> writes:
> On Tue, Feb 05, 2019 at 01:11:18PM +0200, Felipe Balbi wrote:
>> Now that buffer size is always passed around, we don't need to rely on
>> strcat anymore.
>>
>> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
>> ---
>> drivers/usb/dwc3/debug.h | 14 +++++++++-----
>> 1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h
>> index e925a6b73005..6759a7efd8d5 100644
>> --- a/drivers/usb/dwc3/debug.h
>> +++ b/drivers/usb/dwc3/debug.h
>> @@ -545,21 +545,25 @@ static inline const char *dwc3_ep_event_string(char *str, size_t size,
>> status & DEPEVT_STATUS_TRANSFER_ACTIVE ?
>> " (Active)" : " (Not Active)");
>>
>> + len = strlen(str);
>> +
>
> I don't see 'len' used after this. Did you mean to s/ret/len/ in the
> snprintf() calls below?
>
> Alternatively couldn't you just use 'ret' as an accumulator each time
> snprintf() is called to keep count of the bytes written to the buffer
> instead of needing to call strlen() [O(n) each time] multiple times?
yeah, this is leftover. Just forgot to remove it.
next reply other threads:[~2019-02-06 6:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 6:29 Felipe Balbi [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-02-06 6:31 [2/2] usb: dwc3: debug: purge usage of strcat Felipe Balbi
2019-02-05 22:42 Jack Pham
2019-02-05 11:11 Felipe Balbi
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=87r2clmntv.fsf@linux.intel.com \
--to=felipe.balbi@linux.intel.com \
--cc=jackp@codeaurora.org \
--cc=linux-usb@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).