mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Daniel Scally <djrscally@gmail.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yong Zhi <yong.zhi@intel.com>, Bingbu Cao <bingbu.cao@intel.com>,
	Tianshu Qiu <tian.shu.qiu@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: Re: [PATCH v1 1/1] media: ipu3-cio2: Fix referece counting when looping over ACPI devices
Date: Wed, 21 Apr 2021 17:03:40 +0300	[thread overview]
Message-ID: <20210421140340.GD3@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20210404181409.1451026-1-andy.shevchenko@gmail.com>

Hi Andy,

Thanks for the patch.

On Sun, Apr 04, 2021 at 09:14:09PM +0300, Andy Shevchenko wrote:
> When we continue, due to device is disabled, loop we have to drop reference count.
> When we have an array full of devices we have to also drop the reference count.
> Note, in this case the cio2_bridge_unregister_sensors() is called by the caller.

Please limit the commit message to 75 chars, at least if there's no reason
to do otherwise.

I can wrap it this time.

> 
> Fixes: 803abec64ef9 ("media: ipu3-cio2: Add cio2-bridge to ipu3-cio2 driver")
> Cc: Daniel Scally <djrscally@gmail.com>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  drivers/media/pci/intel/ipu3/cio2-bridge.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.c b/drivers/media/pci/intel/ipu3/cio2-bridge.c
> index c2199042d3db..85f8b587405e 100644
> --- a/drivers/media/pci/intel/ipu3/cio2-bridge.c
> +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c
> @@ -173,14 +173,15 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg,
>  	int ret;
>  
>  	for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) {
> -		if (!adev->status.enabled)
> +		if (!adev->status.enabled) {
> +			acpi_dev_put(adev);
>  			continue;
> +		}
>  
>  		if (bridge->n_sensors >= CIO2_NUM_PORTS) {
> +			acpi_dev_put(adev);
>  			dev_err(&cio2->dev, "Exceeded available CIO2 ports\n");
> -			cio2_bridge_unregister_sensors(bridge);
> -			ret = -EINVAL;
> -			goto err_out;
> +			return -EINVAL;
>  		}
>  
>  		sensor = &bridge->sensors[bridge->n_sensors];
> @@ -228,7 +229,6 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg,
>  	software_node_unregister_nodes(sensor->swnodes);
>  err_put_adev:
>  	acpi_dev_put(sensor->adev);
> -err_out:
>  	return ret;
>  }
>  

-- 
Regards,

Sakari Ailus

  parent reply	other threads:[~2021-04-21 14:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04 18:14 Andy Shevchenko
2021-04-05 20:37 ` Daniel Scally
2021-04-13 16:10   ` Andy Shevchenko
2021-04-21 14:03 ` Sakari Ailus [this message]
2021-04-21 15:05   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210421140340.GD3@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bingbu.cao@intel.com \
    --cc=djrscally@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=tian.shu.qiu@intel.com \
    --cc=yong.zhi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®