RDMA/usnic: Fix misuse of sysfs_emit_at
authorJoe Perches <joe@perches.com>
Sat, 16 Jan 2021 00:36:50 +0000 (16:36 -0800)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 20 Jan 2021 00:27:29 +0000 (20:27 -0400)
commitf068cb1db2cb40c9782874df7b08c684106cf609
tree4808c50c2ba6a4a9fc3bd0be1e0e177d69950093
parentde641d74fb00f5b32f054ee154e31fb037e0db88
RDMA/usnic: Fix misuse of sysfs_emit_at

In commit e28bf1f03b01 ("RDMA: Convert various random sprintf sysfs _show
uses to sysfs_emit") I mistakenly used len = sysfs_emit_at to overwrite
the last trailing space of potentially multiple entry output.

Instead use a more common style by removing the trailing space from the
output formats and adding a prefixing space to the contination formats and
converting the final terminating output newline from the defective
len = sysfs_emit_at(buf, len, "\n");
to the now appropriate and typical
len += sysfs_emit_at(buf, len, "\n");

Fixes: e28bf1f03b01 ("RDMA: Convert various random sprintf sysfs _show uses to sysfs_emit")
Link: https://lore.kernel.org/r/5eb794b9c9bca0494d94b2b209f1627fa4e7b555.camel@perches.com
Reported-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/usnic/usnic_ib_sysfs.c