diff mbox series

tty: rfcomm: use sysfs_emit() instead of sprintf()

Message ID 20241122111939.3799277-1-zhangheng@kylinos.cn (mailing list archive)
State New
Headers show
Series tty: rfcomm: use sysfs_emit() instead of sprintf() | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/SubjectPrefix fail "Bluetooth: " prefix is not specified in the subject
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester fail TestRunner_iso-tester: WARNING: possible circular locking dependency detected
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS

Commit Message

zhangheng Nov. 22, 2024, 11:19 a.m. UTC
Follow the advice in Documentation/filesystems/sysfs.rst:
show() should only use sysfs_emit() or sysfs_emit_at() when formatting
the value to be returned to user space.

Signed-off-by: zhangheng <zhangheng@kylinos.cn>
---
 net/bluetooth/rfcomm/tty.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Nov. 22, 2024, 11:54 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=911766

---Test result---

Test Summary:
CheckPatch                    PENDING   0.37 seconds
GitLint                       PENDING   0.47 seconds
SubjectPrefix                 FAIL      0.39 seconds
BuildKernel                   PASS      25.40 seconds
CheckAllWarning               PASS      28.11 seconds
CheckSparse                   PASS      30.81 seconds
BuildKernel32                 PASS      25.03 seconds
TestRunnerSetup               PASS      444.43 seconds
TestRunner_l2cap-tester       PASS      20.47 seconds
TestRunner_iso-tester         FAIL      30.93 seconds
TestRunner_bnep-tester        PASS      4.78 seconds
TestRunner_mgmt-tester        PASS      123.15 seconds
TestRunner_rfcomm-tester      PASS      7.52 seconds
TestRunner_sco-tester         PASS      15.47 seconds
TestRunner_ioctl-tester       PASS      8.43 seconds
TestRunner_mesh-tester        PASS      6.21 seconds
TestRunner_smp-tester         PASS      7.18 seconds
TestRunner_userchan-tester    PASS      5.08 seconds
IncrementalBuild              PENDING   0.46 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix
Output:
"Bluetooth: " prefix is not specified in the subject
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
Total: 124, Passed: 120 (96.8%), Failed: 0, Not Run: 4
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
Paul Menzel Nov. 22, 2024, 12:39 p.m. UTC | #2
Dear Zhangheng,


Thank you for your patch.

Am 22.11.24 um 12:19 schrieb zhangheng:
> Follow the advice in Documentation/filesystems/sysfs.rst:
> show() should only use sysfs_emit() or sysfs_emit_at() when formatting
> the value to be returned to user space.
> 
> Signed-off-by: zhangheng <zhangheng@kylinos.cn>

Is zhangheng the official spelling of your name? If not, please update.

> ---
>   net/bluetooth/rfcomm/tty.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
> index af80d599c337..21a5b5535ebc 100644
> --- a/net/bluetooth/rfcomm/tty.c
> +++ b/net/bluetooth/rfcomm/tty.c
> @@ -201,14 +201,14 @@ static ssize_t address_show(struct device *tty_dev,
>   			    struct device_attribute *attr, char *buf)
>   {
>   	struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
> -	return sprintf(buf, "%pMR\n", &dev->dst);
> +	return sysfs_emit(buf, "%pMR\n", &dev->dst);
>   }
>   
>   static ssize_t channel_show(struct device *tty_dev,
>   			    struct device_attribute *attr, char *buf)
>   {
>   	struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
> -	return sprintf(buf, "%d\n", dev->channel);
> +	return sysfs_emit(buf, "%d\n", dev->channel);
>   }
>   
>   static DEVICE_ATTR_RO(address);


Kind regards,

Paul
diff mbox series

Patch

diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index af80d599c337..21a5b5535ebc 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -201,14 +201,14 @@  static ssize_t address_show(struct device *tty_dev,
 			    struct device_attribute *attr, char *buf)
 {
 	struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
-	return sprintf(buf, "%pMR\n", &dev->dst);
+	return sysfs_emit(buf, "%pMR\n", &dev->dst);
 }
 
 static ssize_t channel_show(struct device *tty_dev,
 			    struct device_attribute *attr, char *buf)
 {
 	struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
-	return sprintf(buf, "%d\n", dev->channel);
+	return sysfs_emit(buf, "%d\n", dev->channel);
 }
 
 static DEVICE_ATTR_RO(address);