Skip to content

Commit

Permalink
floppy: cleanups: use memcpy() to copy reply_buffer
Browse files Browse the repository at this point in the history
Use memcpy() in raw_cmd_done() to copy reply_buffer instead
of a for loop.

Signed-off-by: Denis Efremov <efremov@linux.com>
Link: https://lore.kernel.org/r/20210416083449.72700-5-efremov@linux.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
evdenis authored and axboe committed Apr 20, 2021
1 parent f6df18f commit fa6b885
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2988,17 +2988,14 @@ 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;
} else {
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;
Expand Down

0 comments on commit fa6b885

Please sign in to comment.