diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 389f4e5256fa..c0056c391c7e 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -568,12 +568,13 @@ phy_registers_show(struct device *dev, struct device_attribute *attr, char *buf) { struct phy_device *phydev = to_phy_device(dev); int index; + int len = 0; for (index = 0; index < 32; index++) - sprintf(buf, "%s%2d: 0x%x\n", buf, index, - phy_read(phydev, index)); + len += sysfs_emit_at(buf, len, "%2d: 0x%x\n", index, + phy_read(phydev, index)); - return strlen(buf); + return len; } static ssize_t