mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] md-multipath: Replace a seq_printf() call by seq_putc() in multipath_status()
@ 2019-07-01 11:16 Markus Elfring
  2019-07-03 12:17 ` Song Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2019-07-01 11:16 UTC (permalink / raw)
  To: linux-raid, Shaohua Li; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 1 Jul 2019 13:07:55 +0200

A single character (depending on a condition check) should be put
into a sequence. Thus use the corresponding function “seq_putc”.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/md/md-multipath.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/md-multipath.c b/drivers/md/md-multipath.c
index 6780938d2991..3bf6f97ea264 100644
--- a/drivers/md/md-multipath.c
+++ b/drivers/md/md-multipath.c
@@ -146,7 +146,8 @@ static void multipath_status(struct seq_file *seq, struct mddev *mddev)
 	rcu_read_lock();
 	for (i = 0; i < conf->raid_disks; i++) {
 		struct md_rdev *rdev = rcu_dereference(conf->multipaths[i].rdev);
-		seq_printf (seq, "%s", rdev && test_bit(In_sync, &rdev->flags) ? "U" : "_");
+		seq_putc(seq,
+			 rdev && test_bit(In_sync, &rdev->flags) ? 'U' : '_');
 	}
 	rcu_read_unlock();
 	seq_putc(seq, ']');
--
2.22.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] md-multipath: Replace a seq_printf() call by seq_putc() in multipath_status()
  2019-07-01 11:16 [PATCH] md-multipath: Replace a seq_printf() call by seq_putc() in multipath_status() Markus Elfring
@ 2019-07-03 12:17 ` Song Liu
  2019-07-03 16:28   ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Song Liu @ 2019-07-03 12:17 UTC (permalink / raw)
  To: Markus Elfring; +Cc: linux-raid, Shaohua Li, LKML, kernel-janitors

On Mon, Jul 1, 2019 at 5:25 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 1 Jul 2019 13:07:55 +0200
>
> A single character (depending on a condition check) should be put
> into a sequence. Thus use the corresponding function “seq_putc”.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Can you explain why this is necessary?

Thanks,
Song

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: md-multipath: Replace a seq_printf() call by seq_putc() in multipath_status()
  2019-07-03 12:17 ` Song Liu
@ 2019-07-03 16:28   ` Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-07-03 16:28 UTC (permalink / raw)
  To: Song Liu, linux-raid; +Cc: Shaohua Li, LKML, kernel-janitors

>> A single character (depending on a condition check) should be put
>> into a sequence. Thus use the corresponding function “seq_putc”.
> Can you explain why this is necessary?

I suggest another bit of software fine-tuning.

* Pass only a relevant character instead of a string.

* Omit the format string for a function parameter.

Regards,
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-03 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01 11:16 [PATCH] md-multipath: Replace a seq_printf() call by seq_putc() in multipath_status() Markus Elfring
2019-07-03 12:17 ` Song Liu
2019-07-03 16:28   ` Markus Elfring

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®