linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Efremov <efremov@linux.com>
To: linux-block@vger.kernel.org
Cc: Denis Efremov <efremov@linux.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] floppy: cleanups: use memcpy() to copy reply_buffer
Date: Fri, 16 Apr 2021 11:34:48 +0300	[thread overview]
Message-ID: <20210416083449.72700-5-efremov@linux.com> (raw)
In-Reply-To: <20210416083449.72700-1-efremov@linux.com>

Use memcpy() in raw_cmd_done() to copy reply_buffer instead
of a for loop.

Signed-off-by: Denis Efremov <efremov@linux.com>
---
 drivers/block/floppy.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index c58b0b079afc..c584657bacab 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2988,8 +2988,6 @@ static const char *drive_name(int type, int drive)
 /* raw commands */
 static void raw_cmd_done(int flag)
 {
-	int i;
-
 	if (!flag) {
 		raw_cmd->flags |= FD_RAW_FAILURE;
 		raw_cmd->flags |= FD_RAW_HARDFAILURE;
@@ -2997,8 +2995,7 @@ static void raw_cmd_done(int flag)
 		raw_cmd->reply_count = inr;
 		if (raw_cmd->reply_count > FD_RAW_REPLY_SIZE)
 			raw_cmd->reply_count = 0;
-		for (i = 0; i < raw_cmd->reply_count; i++)
-			raw_cmd->reply[i] = reply_buffer[i];
+		memcpy(raw_cmd->reply, reply_buffer, raw_cmd->reply_count);
 
 		if (raw_cmd->flags & (FD_RAW_READ | FD_RAW_WRITE)) {
 			unsigned long flags;
-- 
2.30.2


  parent reply	other threads:[~2021-04-16  8:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16  8:34 [PATCH 0/5] Another small set of cleanups for floppy driver Denis Efremov
2021-04-16  8:34 ` [PATCH 1/5] floppy: cleanups: remove trailing whitespaces Denis Efremov
2021-04-16  8:34 ` [PATCH 2/5] floppy: cleanups: use ST0 as reply_buffer index 0 Denis Efremov
2021-04-16  8:34 ` [PATCH 3/5] floppy: cleanups: use memset() to zero reply_buffer Denis Efremov
2021-04-16  8:34 ` Denis Efremov [this message]
2021-04-16  8:34 ` [PATCH 5/5] floppy: cleanups: remove FLOPPY_SILENT_DCL_CLEAR undef Denis Efremov
2021-04-16 12:05 ` [PATCH 0/5] Another small set of cleanups for floppy driver Jens Axboe

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=20210416083449.72700-5-efremov@linux.com \
    --to=efremov@linux.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).