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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxxx>

> Fixes: 066c67624d8c ("ASoC: SOF: ipc-msg-injector: Add support for IPC4 messages")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
>  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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux