[PATCH 2/2] utils: ipu3: Fix return value check on file output

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Feb 26 11:07:10 CET 2024


Hi Kieran,

Thank you for the patch.

On Mon, Feb 26, 2024 at 09:48:57AM +0000, Kieran Bingham wrote:
> The data parsed by ipu3-unpack is written out using the write() c

s/c$/C/

> library call, but the error code is incorrectly checked which misses the
> single erroroneous return value returned by the function.
> 
> Fix it to explicitly check against the error code.
> 
> Reported-by: Johan Mattsson <39247600+mjunix at users.noreply.github.com>

With this dropped,

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> Fixes: 23ac77dc4a09 ("utils: ipu3: Add IPU3 raw capture unpack utility")
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  utils/ipu3/ipu3-unpack.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/ipu3/ipu3-unpack.c b/utils/ipu3/ipu3-unpack.c
> index 9d2c1200d932..c96fafed2435 100644
> --- a/utils/ipu3/ipu3-unpack.c
> +++ b/utils/ipu3/ipu3-unpack.c
> @@ -78,7 +78,7 @@ int main(int argc, char *argv[])
>  		}
>  
>  		ret = write(out_fd, out_data, 50);
> -		if (ret < -1) {
> +		if (ret == -1) {
>  			fprintf(stderr, "Failed to write output data: %s\n",
>  				strerror(errno));
>  			goto done;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list