Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+6 -8
+6 -8
drivers/platform/x86/intel_cht_int33fe_common.c
··· 29 29 30 30 static int cht_int33fe_count_i2c_clients(struct device *dev) 31 31 { 32 - struct acpi_device *adev; 32 + struct acpi_device *adev = ACPI_COMPANION(dev); 33 33 LIST_HEAD(resource_list); 34 34 int count = 0; 35 + int ret; 35 36 36 - adev = ACPI_COMPANION(dev); 37 - if (!adev) 38 - return -EINVAL; 39 - 40 - acpi_dev_get_resources(adev, &resource_list, 41 - cht_int33fe_i2c_res_filter, &count); 42 - 37 + ret = acpi_dev_get_resources(adev, &resource_list, 38 + cht_int33fe_i2c_res_filter, &count); 43 39 acpi_dev_free_resource_list(&resource_list); 40 + if (ret < 0) 41 + return ret; 44 42 45 43 return count; 46 44 }