diff mbox series

[PATCHv2,2/2] media: atomisp: don't use sizeof(NULL)

Message ID 30f42c75-5a36-4ed0-90af-77764308f267@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Hans Verkuil Feb. 2, 2024, 10:17 a.m. UTC
Check the size of another pointer instead of NULL. This fixes this
smatch warning:

drivers/staging/media/atomisp/pci/sh_css.c:3609 ia_css_pipe_enqueue_buffer() warn: sizeof(NUMBER)?

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
---
Changes since v1: replace NULL by void *, that's better than using a pointer variable.
---
 drivers/staging/media/atomisp/pci/sh_css.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas Dufresne Feb. 9, 2024, 4:01 p.m. UTC | #1
Le vendredi 02 février 2024 à 11:17 +0100, Hans Verkuil a écrit :
> Check the size of another pointer instead of NULL. This fixes this
> smatch warning:
> 
> drivers/staging/media/atomisp/pci/sh_css.c:3609 ia_css_pipe_enqueue_buffer() warn: sizeof(NUMBER)?
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Fixes: ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")

You sent v2 the same day. Please have a look at my comment in the v1.

cheers,
Nicolas

> ---
> Changes since v1: replace NULL by void *, that's better than using a pointer variable.
> ---
>  drivers/staging/media/atomisp/pci/sh_css.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
> index 1d1fbda75da1..938a4ea89c59 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css.c
> +++ b/drivers/staging/media/atomisp/pci/sh_css.c
> @@ -3606,7 +3606,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,
> 
>  	assert(pipeline || pipe_id == IA_CSS_PIPE_ID_COPY);
> 
> -	assert(sizeof(NULL) <= sizeof(ddr_buffer.kernel_ptr));
> +	assert(sizeof(void *) <= sizeof(ddr_buffer.kernel_ptr));
>  	ddr_buffer.kernel_ptr = HOST_ADDRESS(NULL);
>  	ddr_buffer.cookie_ptr = buffer->driver_cookie;
>  	ddr_buffer.timing_data = buffer->timing_data;
diff mbox series

Patch

diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c
index 1d1fbda75da1..938a4ea89c59 100644
--- a/drivers/staging/media/atomisp/pci/sh_css.c
+++ b/drivers/staging/media/atomisp/pci/sh_css.c
@@ -3606,7 +3606,7 @@  ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,

 	assert(pipeline || pipe_id == IA_CSS_PIPE_ID_COPY);

-	assert(sizeof(NULL) <= sizeof(ddr_buffer.kernel_ptr));
+	assert(sizeof(void *) <= sizeof(ddr_buffer.kernel_ptr));
 	ddr_buffer.kernel_ptr = HOST_ADDRESS(NULL);
 	ddr_buffer.cookie_ptr = buffer->driver_cookie;
 	ddr_buffer.timing_data = buffer->timing_data;