drivers/intel/mipi_camera: Avoid resource leak
Coverity detects variable dsd going out of scope leaks the storage it points to. Move dsd resource allocation after sanity check for config->nvm_compact to avoid leak. Found-by: Coverity CID 1432727 TEST=Built and boot up to kernel on Volteer. Signed-off-by: John Zhao <john.zhao@intel.com> Change-Id: I86af322dc78845b8b312b6815135336c2c56b4dd Reviewed-on: https://review.coreboot.org/c/coreboot/+/45531 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
committed by
Patrick Georgi
parent
342d0a8365
commit
388e551dc3
@ -452,11 +452,13 @@ static void camera_fill_sensor(const struct device *dev)
|
|||||||
static void camera_fill_nvm(const struct device *dev)
|
static void camera_fill_nvm(const struct device *dev)
|
||||||
{
|
{
|
||||||
struct drivers_intel_mipi_camera_config *config = dev->chip_info;
|
struct drivers_intel_mipi_camera_config *config = dev->chip_info;
|
||||||
struct acpi_dp *dsd = acpi_dp_new_table("_DSD");
|
struct acpi_dp *dsd;
|
||||||
|
|
||||||
if (!config->nvm_compat)
|
if (!config->nvm_compat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
dsd = acpi_dp_new_table("_DSD");
|
||||||
|
|
||||||
/* It might be possible to default size or width based on type. */
|
/* It might be possible to default size or width based on type. */
|
||||||
if (!config->disable_nvm_defaults && !config->nvm_pagesize)
|
if (!config->disable_nvm_defaults && !config->nvm_pagesize)
|
||||||
config->nvm_pagesize = 1;
|
config->nvm_pagesize = 1;
|
||||||
|
Reference in New Issue
Block a user