ibmasmfs: Use common error handling code in command_file_read()
Subsystems (2)
PATCH 1/1 ibmasmfs: Use common error handling code in command_file_read()
From: Markus Elfring <[email protected]>
Date: Wed, 18 Sep 2024 19:50:27 +0200
Add a label so that a bit of exception handling can be better reused at the end of this function implementation.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
--- drivers/misc/ibmasm/ibmasmfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/misc/ibmasm/ibmasmfs.c +5 -4
@@ -280,14 +280,15 @@ static ssize_t command_file_read(struct file *file, char __user *buf, size_t couspin_unlock_irqrestore (&command_data->sp->lock, flags);if (cmd->status !=IBMASM_CMD_COMPLETE ) { -command_put (cmd); -return -EIO ; + len = -EIO ; + goto put_command; } len =min (count, cmd->buffer_size);if (copy_to_user (buf, cmd->buffer, len)) { -command_put (cmd); -return -EFAULT ; + len = -EFAULT ; + goto put_command; } +put_command:command_put (cmd);return len;
--
2.46.0