drivers: video: fix NULL dereference in mipid02_get_fmt

Category: Null pointer dereference (CWE-476)

Corrects the logic that validates the result of mipid04_get_format_desc().
Previously, the check was inverted, which could lead to a NULL pointer
dereference when accessing desc->pixelformat.

Fixes Coverity CID: 525183

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
This commit is contained in:
sudarsan N 2025-06-18 15:43:02 +05:30 committed by Fabio Baltieri
parent efee13e380
commit 48bbbfe976

View File

@ -189,7 +189,7 @@ static int mipid02_get_fmt(const struct device *dev, struct video_format *fmt)
}
desc = mipid02_get_format_desc(fmt->pixelformat);
if (desc) {
if (desc == NULL) {
LOG_ERR("Sensor format not supported by the ST-MIPID02");
return -EIO;
}