Re: [PATCH v3 18/18] media: atomisp: csi2-bridge: Add support for VCM I2C-client instantiation

Andy Shevchenko
2023-07-06T10:16:19Z

On Wed, Jul 05, 2023 at 11:30:10PM +0200, Hans de Goede wrote:
> Fill sensor->vcm_type and call intel_cio2_bridge_instantiate_vcm() from
> the v4l2-async bound op so that an I2C-client will be instatiated for
> the VCM.
>
> Note unfortunately on atomisp the _DSM to get the VCM type sometimes
> returns a VCM even though there is none. Since VCMs are typically only
> used together with certain sensors, work around this by adding a vcm
> field to atomisp_sensor_config and only check for a VCM when that is set.

...

> +static char *atomisp_csi2_get_vcm_type(struct acpi_device *adev)
> +{
> + union acpi_object *obj;
> + char *vcm_type;
> +
> + obj = acpi_evaluate_dsm_typed(adev->handle, &vcm_dsm_guid, 0, 0,
> + NULL, ACPI_TYPE_STRING);
> + if (!obj)
> + return NULL;
> +
> + vcm_type = kstrdup(obj->string.pointer, GFP_KERNEL);

Where is the counterpart kfree()?

> + ACPI_FREE(obj);
> +
> + if (!vcm_type)
> + return NULL;
> +
> + string_lower(vcm_type, vcm_type);
> + return vcm_type;
> +}

--
With Best Regards,
Andy Shevchenko