Re: [PATCH v1 1/1] media: ipu3-cio2: Drop reference on error path in cio2_bridge_connect_sensor()

Sakari Ailus
2021-07-26T11:44:44Z

Hi Andy,

On Mon, Jul 26, 2021 at 11:40:55AM +0300, Andy Shevchenko wrote:
> The commit 71f642833284 ("ACPI: utils: Fix reference counting in
> for_each_acpi_dev_match()") moved adev assignment outside of error
> path and hence made acpi_dev_put(sensor->adev) a no-op. We still
> need to drop reference count on error path, and to achieve that,
> replace sensor->adev by locally assigned adev.
>
> Fixes: 71f642833284 ("ACPI: utils: Fix reference counting in for_each_acpi_dev_match()")
> Depends-on: fc68f42aa737 ("ACPI: fix NULL pointer dereference")
> Reported-by: Jens Axboe <axboe@kernel.dk>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/media/pci/intel/ipu3/cio2-bridge.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.c b/drivers/media/pci/intel/ipu3/cio2-bridge.c
> index 59a36f922675..30d29b96a339 100644
> --- a/drivers/media/pci/intel/ipu3/cio2-bridge.c
> +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c
> @@ -226,7 +226,7 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg,
> err_free_swnodes:
> software_node_unregister_nodes(sensor->swnodes);
> err_put_adev:
> - acpi_dev_put(sensor->adev);
> + acpi_dev_put(adev);

adev is assigned to sensor->adev before goto so the two have the same
value. I have no problem with the patch though.

> return ret;
> }
>

--
Regards,

Sakari Ailus