Skip to contentSkip to conversation

i2c: acpi: Drop double check for ACPI companion device

PATCH Applied Andy Shevchenko 2 participants 2 messages May 28, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: acpi: 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.

---
 drivers/i2c/i2c-core-acpi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/i2c/i2c-core-acpi.c +1 -5
index c8f42f2037cb..2ade99b105b9 100644
@@ -468,16 +468,12 @@ struct notifier_block i2c_acpi_notifier = {
 struct i2c_client *i2c_acpi_new_device(struct device *dev, int index,
 				       struct i2c_board_info *info)
 {
+	struct acpi_device *adev = ACPI_COMPANION(dev);
 	struct i2c_acpi_lookup lookup;
 	struct i2c_adapter *adapter;
-	struct acpi_device *adev;
 	LIST_HEAD(resource_list);
 	int ret;
 
-	adev = ACPI_COMPANION(dev);
-	if (!adev)
-		return ERR_PTR(-EINVAL);
-
 	memset(&lookup, 0, sizeof(lookup));
 	lookup.info = info;
 	lookup.device_handle = acpi_device_handle(adev);
Signature · 1 line
2.26.2
Applied
#1 lore raw
Quoted 5 lines · Andy Shevchenko

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.

Applied to for-next, thanks!