On Wed, Nov 11, 2020 at 03:53:20PM +0000, Dave Martin wrote: > On Wed, Nov 11, 2020 at 07:11:33AM +0000, Leo Yan wrote: > > When outputs strings to the decoding buffer with function snprintf(), > > SPE decoder needs to detects if any error returns from snprintf() and if > > so needs to directly bail out. If snprintf() returns success, it needs > > to update buffer pointer and reduce the buffer length so can continue to > > output the next string into the consequent memory space. > > > > This complex logics are spreading in the function arm_spe_pkt_desc() so > > there has many duplicate codes for handling error detecting, increment > > buffer pointer and decrement buffer size. > > > > To avoid the duplicate code, this patch introduces a new helper function > > arm_spe_pkt_snprintf() which is used to wrap up the complex logics, and > > it's used by the caller arm_spe_pkt_desc(). > > > > This patch also moves the variable 'blen' as the function's local > > variable, this allows to remove the unnecessary braces and improve the > > readability. > > > > Suggested-by: Dave Martin <dave.mar...@arm.com> > > Signed-off-by: Leo Yan <leo....@linaro.org> > > Reviewed-by: Andre Przywara <andre.przyw...@arm.com> > > Mostly looks fine to me now, thought there are a few potentionalu > issues -- comments below.
Hmm, looks like patch 7 anticipated some of my comments here. Rather than fixing up patch 6, maybe it would be better to squash these patches together after all... sorry! [...] Cheers ---Dave