aboutsummaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorGravatar Andy Shevchenko <andriy.shevchenko@linux.intel.com> 2020-05-26 15:53:29 +0300
committerGravatar Andy Shevchenko <andriy.shevchenko@linux.intel.com> 2020-07-09 22:40:36 +0300
commiteca6f176209937695db01a37814308d367781ab6 (patch)
treeb62f792b61740ddd64d622992b622ad64199156c /drivers/platform
parentLinux 5.8-rc1 (diff)
downloadlinux-eca6f176209937695db01a37814308d367781ab6.tar.gz
linux-eca6f176209937695db01a37814308d367781ab6.tar.bz2
linux-eca6f176209937695db01a37814308d367781ab6.zip
platform/x86: intel_cht_int33fe: Drop double check for ACPI companion device
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>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/intel_cht_int33fe_common.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/platform/x86/intel_cht_int33fe_common.c b/drivers/platform/x86/intel_cht_int33fe_common.c
index 42dd11623f56..251ed9bac789 100644
--- a/drivers/platform/x86/intel_cht_int33fe_common.c
+++ b/drivers/platform/x86/intel_cht_int33fe_common.c
@@ -29,18 +29,16 @@ static int cht_int33fe_i2c_res_filter(struct acpi_resource *ares, void *data)
static int cht_int33fe_count_i2c_clients(struct device *dev)
{
- struct acpi_device *adev;
+ struct acpi_device *adev = ACPI_COMPANION(dev);
LIST_HEAD(resource_list);
int count = 0;
+ int ret;
- adev = ACPI_COMPANION(dev);
- if (!adev)
- return -EINVAL;
-
- acpi_dev_get_resources(adev, &resource_list,
- cht_int33fe_i2c_res_filter, &count);
-
+ ret = acpi_dev_get_resources(adev, &resource_list,
+ cht_int33fe_i2c_res_filter, &count);
acpi_dev_free_resource_list(&resource_list);
+ if (ret < 0)
+ return ret;
return count;
}