From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>, ioana.ciornei@nxp.com
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] bus: fsl-mc: Replace snprintf and sprintf with sysfs_emit in sysfs show functions
Date: Mon, 22 Sep 2025 16:58:21 +0200 [thread overview]
Message-ID: <617e83e9-c9ad-45d1-bc5a-eba2ecd7965f@csgroup.eu> (raw)
In-Reply-To: <20250822124339.1739290-1-chelsyratnawat2001@gmail.com>
Le 22/08/2025 à 14:43, Chelsy Ratnawat a écrit :
> [Vous ne recevez pas souvent de courriers de chelsyratnawat2001@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
>
> Use sysfs_emit() instead of snprintf()/sprintf() when writing
> to sysfs buffers, as recommended by the kernel documentation.
>
> Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
> ---
> Changes in v2:
> - replace sprintf() with sysfs_emit() in modalias_show()
> - change commit msg to include the change for sprintf
>
> drivers/bus/fsl-mc/fsl-mc-bus.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index c1c0a4759c7e..88fea34a55b9 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -176,8 +176,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
> {
> struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
>
> - return sprintf(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
> - mc_dev->obj_desc.type);
> + return sysfs_emit(buf, "fsl-mc:v%08Xd%s\n", mc_dev->obj_desc.vendor,
> + mc_dev->obj_desc.type);
> }
> static DEVICE_ATTR_RO(modalias);
>
> @@ -203,7 +203,7 @@ static ssize_t driver_override_show(struct device *dev,
> {
> struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
>
> - return snprintf(buf, PAGE_SIZE, "%s\n", mc_dev->driver_override);
> + return sysfs_emit(buf, "%s\n", mc_dev->driver_override);
> }
> static DEVICE_ATTR_RW(driver_override);
>
> --
> 2.47.3
>
>
Applied, thanks!
Christophe
prev parent reply other threads:[~2025-09-22 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 12:43 Chelsy Ratnawat
2025-08-25 15:48 ` Ioana Ciornei
2025-09-22 14:58 ` Christophe Leroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=617e83e9-c9ad-45d1-bc5a-eba2ecd7965f@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=chelsyratnawat2001@gmail.com \
--cc=ioana.ciornei@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®