Skip to contentSkip to conversation

coresight: Drop double check for ACPI companion device

PATCH In review Andy Shevchenko 2 participants 2 messages May 29, 2020 – Jun 1, 2020

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

PATCH 1/1 coresight: 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/hwtracing/coresight/coresight-stm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwtracing/coresight/coresight-stm.c +0 -2
index b908ca104645..673d2f56ed1e 100644
@@ -727,8 +727,6 @@ static int acpi_stm_get_stimulus_area(struct device *dev, struct resource *res)
 
 	struct acpi_device *adev = ACPI_COMPANION(dev);
 
-	if (!adev)
-		return -ENODEV;
 	rc = acpi_dev_get_resources(adev, &res_list, NULL, NULL);
 	if (rc < 0)
 		return rc;
Signature · 1 line
2.26.2
#1 lore raw

Hi Andy,

Quoted 14 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.

---
 drivers/hwtracing/coresight/coresight-stm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/hwtracing/coresight/coresight-stm.c +0 -0
index b908ca104645..673d2f56ed1e 100644

drivers/hwtracing/coresight/coresight-stm.c static int acpi_stm_get_stimulus_area(struct device *dev, struct resource *res) · line 732

Quoted 8 lines
drivers/hwtracing/coresight/coresight-stm.c +0 -2
@@ -727,8 +727,6 @@ static int acpi_stm_get_stimulus_area(struct device *dev, struct resource *res)
 
 	struct acpi_device *adev = ACPI_COMPANION(dev);
 
-	if (!adev)
-		return -ENODEV;
 	rc = acpi_dev_get_resources(adev, &res_list, NULL, NULL);
 	if (rc < 0)
 		return rc;

I have applied your patch.

Thanks,
Mathieu

Quoted 3 lines
Signature · 1 line
2.26.2