PCI/sysfs: Add 'devspec' newline
authorKrzysztof Wilczyński <kw@linux.com>
Thu, 3 Jun 2021 00:01:10 +0000 (00:01 +0000)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 4 Jun 2021 14:21:07 +0000 (09:21 -0500)
Previously, when the value of the "devspec" sysfs attribute was read from
the user space there was no newline present, and utilities such as "cat"
wouldn't display the result of the read correctly.

Append a newline character in the show() function to match other "devspec"
attributes.

Link: https://lore.kernel.org/r/20210603000112.703037-5-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
drivers/pci/pci-sysfs.c

index beb8d1f..5d63df7 100644 (file)
@@ -537,7 +537,7 @@ static ssize_t devspec_show(struct device *dev,
 
        if (np == NULL)
                return 0;
-       return sysfs_emit(buf, "%pOF", np);
+       return sysfs_emit(buf, "%pOF\n", np);
 }
 static DEVICE_ATTR_RO(devspec);
 #endif