Hi, Jack Pham <jackp@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx> >> --- >> 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. -- balbi
Attachment:
signature.asc
Description: PGP signature