diff mbox series

[2/2] ASoC: SOF: ipc-msg-injector: Fix reversed if statement

Message ID Yph+T3PpGCdPsEDj@kili
State Accepted
Commit bedc357217e6e09623f6209c891fa8d57a737ac1
Headers show
Series [1/2] ASoC: SOF: ipc-msg-injector: Propagate write errors correctly | expand

Commit Message

Dan Carpenter June 2, 2022, 9:09 a.m. UTC
This if statement is reversed.  In fact, the condition can just be
deleted because writing zero bytes is a no-op.

Fixes: 066c67624d8c ("ASoC: SOF: ipc-msg-injector: Add support for IPC4 messages")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 sound/soc/sof/sof-client-ipc-msg-injector.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/sof/sof-client-ipc-msg-injector.c b/sound/soc/sof/sof-client-ipc-msg-injector.c
index 030cb97d7713..6bdfa527b7f7 100644
--- a/sound/soc/sof/sof-client-ipc-msg-injector.c
+++ b/sound/soc/sof/sof-client-ipc-msg-injector.c
@@ -200,16 +200,14 @@  static ssize_t sof_msg_inject_ipc4_dfs_write(struct file *file,
 		return -EFAULT;
 
 	count -= size;
-	if (!count) {
-		/* Copy the payload */
-		size = simple_write_to_buffer(ipc4_msg->data_ptr,
-					      priv->max_msg_size, ppos, buffer,
-					      count);
-		if (size < 0)
-			return size;
-		if (size != count)
-			return -EFAULT;
-	}
+	/* Copy the payload */
+	size = simple_write_to_buffer(ipc4_msg->data_ptr,
+				      priv->max_msg_size, ppos, buffer,
+				      count);
+	if (size < 0)
+		return size;
+	if (size != count)
+		return -EFAULT;
 
 	ipc4_msg->data_size = count;