wifi: mt76: mt792x: use sysfs_emit() in thermal temp show callbacks
Subsystems (2)
PATCH 1/1 wifi: mt76: mt792x: use sysfs_emit() in thermal temp show callbacks
From: Jared Huang <[email protected]>
mt7921_thermal_temp_show() and mt7925_thermal_temp_show() write the temperature into the sysfs buffer with sprintf(), which does not know the size of the buffer. sysfs_emit() is the helper meant for sysfs show() callbacks and bounds the output to PAGE_SIZE.
Replace sprintf() with sysfs_emit(). The output is at most 11 bytes, so the behaviour does not change.
Signed-off-by Jared Huang <[email protected]>
--- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7925/init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/init.c +1 -1
@@ -28,7 +28,7 @@ static ssize_t mt7921_thermal_temp_show(struct device *dev,if (temperature <0 )return temperature;/* display in millidegree Celsius */ -return sprintf (buf,"%u\n" , temperature *1000 ); +return sysfs_emit (buf,"%u\n" , temperature *1000 ); }default :return -EINVAL ;
drivers/net/wireless/mediatek/mt76/mt7925/init.c +1 -1
@@ -28,7 +28,7 @@ static ssize_t mt7925_thermal_temp_show(struct device *dev,if (temperature <0 )return temperature;/* display in millidegree Celsius */ -return sprintf (buf,"%u\n" , temperature *1000 ); +return sysfs_emit (buf,"%u\n" , temperature *1000 ); }default :return -EINVAL ;
Signature · 1 line
2.45.2