diff mbox series

[net-next] tg3: use sysfs_emit() in tg3_show_temp()

Message ID 20240328195626.878904-1-kiryushin@ancud.ru (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tg3: use sysfs_emit() in tg3_show_temp() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 950 this patch: 950
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 954 this patch: 954
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 965 this patch: 965
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-29--06-00 (tests: 951)

Commit Message

Nikita Kiryushin March 28, 2024, 7:56 p.m. UTC
Change sprintf() in sysfs show() handler to sysfs_emit(),
as recommended by sysfs documentation.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
---
 drivers/net/ethernet/broadcom/tg3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Chan March 28, 2024, 9:48 p.m. UTC | #1
On Thu, Mar 28, 2024 at 12:56 PM Nikita Kiryushin <kiryushin@ancud.ru> wrote:
>
> Change sprintf() in sysfs show() handler to sysfs_emit(),
> as recommended by sysfs documentation.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>

Reviewed-by: Michael Chan <michael.chan@broadcom.com>

Thanks.  We should eventually migrate to use
hwmon_device_register_with_info() so that we don't have to deal with
these sysfs strings.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 62ff4381ac83..ee1bc578be84 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -10892,7 +10892,7 @@  static ssize_t tg3_show_temp(struct device *dev,
 	tg3_ape_scratchpad_read(tp, &temperature, attr->index,
 				sizeof(temperature));
 	spin_unlock_bh(&tp->lock);
-	return sprintf(buf, "%u\n", temperature * 1000);
+	return sysfs_emit(buf, "%u\n", temperature * 1000);
 }