Skip to contentSkip to conversation

staging: media: atomisp: don't free the current DVS 6-axis table on error

PATCH New Feng Ning 1 participant 1 message Nov 26

Subsystems (4)
lore
Share & tools
lore

Feng Ning

author
#0 lore raw

PATCH 1/1 staging: media: atomisp: don't free the current DVS 6-axis table on error

When the new DVS 6-axis config has the same dimensions as the current one, atomisp_cp_dvs_6axis_config() reuses css_param->dvs_6axis instead of allocating a new table. If one of the following copies fails, the error path frees that table while css_param->dvs_6axis still points to it.

atomisp_set_parameters() handles the error by calling atomisp_free_css_parameters() on the same css_param, which frees css_param->dvs_6axis a second time.

Only free the table on error if it was allocated by this call, and leave the current table to its owner.

Fixes ad85094b293e ("Revert "media: staging: atomisp: Remove driver"")
---
 drivers/staging/media/atomisp/pci/atomisp_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +1 -1
index e66a7d1..afc7dc5 100644
@@ -2718,7 +2718,7 @@ int atomisp_cp_dvs_6axis_config(struct atomisp_sub_device *asd,
 	return 0;
 
 error:
-	if (dvs_6axis_config)
+	if (dvs_6axis_config && dvs_6axis_config != css_param->dvs_6axis)
 		ia_css_dvs2_6axis_config_free(dvs_6axis_config);
 	return ret;
 }
Signature · 1 line
2.55.0