linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-iio@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Subject: Re: [PATCH v1] iio: imu: inv_mpu6050: Drop double check for ACPI companion device
Date: Sun, 31 May 2020 12:22:11 +0100	[thread overview]
Message-ID: <20200531122211.580421be@archlinux> (raw)
In-Reply-To: <20200528141552.57504-1-andriy.shevchenko@linux.intel.com>

On Thu, 28 May 2020 17:15:52 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> acpi_dev_get_resources() does perform the NULL pointer check against
> ACPI companion device which is given as function parameter. Thus,
> there is no need to duplicate this check in the caller.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.

Thanks,

Jonathan

> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> index 2f8560ba4572..bf9bdaf6519a 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c
> @@ -101,8 +101,8 @@ static int inv_mpu_process_acpi_config(struct i2c_client *client,
>  				       unsigned short *primary_addr,
>  				       unsigned short *secondary_addr)
>  {
> +	struct acpi_device *adev = ACPI_COMPANION(&client->dev);
>  	const struct acpi_device_id *id;
> -	struct acpi_device *adev;
>  	u32 i2c_addr = 0;
>  	LIST_HEAD(resources);
>  	int ret;
> @@ -112,10 +112,6 @@ static int inv_mpu_process_acpi_config(struct i2c_client *client,
>  	if (!id)
>  		return -ENODEV;
>  
> -	adev = ACPI_COMPANION(&client->dev);
> -	if (!adev)
> -		return -ENODEV;
> -
>  	ret = acpi_dev_get_resources(adev, &resources,
>  				     acpi_i2c_check_resource, &i2c_addr);
>  	if (ret < 0)


      reply	other threads:[~2020-05-31 11:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 14:15 [PATCH v1] iio: imu: inv_mpu6050: Drop double check for ACPI companion device Andy Shevchenko
2020-05-31 11:22 ` Jonathan Cameron [this message]

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=20200531122211.580421be@archlinux \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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;
as well as URLs for NNTP newsgroup(s).