[Sound-open-firmware] [PATCH 2/2] ASoC: SOF: ipc-msg-injector: Fix reversed if statement

Péter Ujfalusi peter.ujfalusi at linux.intel.com
Fri Jun 3 11:49:56 CEST 2022



On 02/06/2022 12:09, Dan Carpenter wrote:
> This if statement is reversed.  In fact, the condition can just be
> deleted because writing zero bytes is a no-op.

Wow, you are right. I only tested with a message w/o additional payload.

Acked-by: Peter Ujfalusi <peter.ujfalusi at linux.intel.com>

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

-- 
Péter


More information about the Sound-open-firmware mailing list