media: atomisp: Fix me->stages error checking in sh_css_sp_init_pipeline()
authorHans de Goede <hdegoede@redhat.com>
Sun, 30 Jul 2023 15:33:43 +0000 (17:33 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 10 Aug 2023 05:58:33 +0000 (07:58 +0200)
commit9e2a90d75662d2cad22d8e3f3358c1b5392f037d
tree346bf02a00cf8a7f7c52c1eead67f06261d33db9
parent7b4846b6515483396af706329cb51794eb6afb6d
media: atomisp: Fix me->stages error checking in sh_css_sp_init_pipeline()

The current error-checking of me->stages in sh_css_sp_init_pipeline()
has some issues / weirdness:

1. It is checked at the top of the function, but only using the atomisp
   custom assert() macro which e.g. smatch does not recognize

2. It is first dereferenced in "first_binary = me->stages->binary", but
   outside of the assert it is checked much later, triggering the following
   smatch warning:

drivers/staging/media/atomisp/pci/sh_css_sp.c:1255 sh_css_sp_init_pipeline()
warn: variable dereferenced before check 'me->stages' (see line 1224)

Drop the custom assert() calls (note 'me' is never NULL) and instead add
a regular check for me->stages not being set.

Reported-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Closes: https://lore.kernel.org/linux-media/7c8fc5b4-280e-844e-cdf5-b6ec2a1616aa@xs4all.nl/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/staging/media/atomisp/pci/sh_css_sp.c