Skip to contentSkip to conversation

intel_th: remove redundant re-assignment of pointer hubdrv

PATCH Superseded Colin Ian King 2 participants 2 messages Dec 4, 2021 – Dec 7, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel_th: remove redundant re-assignment of pointer hubdrv

The pointer hubdrv is being re-assigned the same value as it was initialized with only a few lines earlier. The re-assignment is redundant and can be removed.

---
 drivers/hwtracing/intel_th/core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/hwtracing/intel_th/core.c +0 -1
index 7e753a75d23b..5de47b89a9e1 100644
@@ -1048,7 +1048,6 @@ int intel_th_set_output(struct intel_th_device *thdev,
 	 * hub is instantiated together with the source device that
 	 * calls here, so guaranteed to be present.
 	 */
-	hubdrv = to_intel_th_driver(hub->dev.driver);
 	if (!hubdrv || !try_module_get(hubdrv->driver.owner))
 		return -EINVAL;
 
Signature · 1 line
2.33.1
#1 lore raw
Quoted 14 lines · Colin Ian King

The pointer hubdrv is being re-assigned the same value as it was initialized with only a few lines earlier. The re-assignment is redundant and can be removed.

---
 drivers/hwtracing/intel_th/core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/hwtracing/intel_th/core.c +0 -0
index 7e753a75d23b..5de47b89a9e1 100644

drivers/hwtracing/intel_th/core.c int intel_th_set_output(struct intel_th_device *thdev, · line 1051

Quoted 5 lines
drivers/hwtracing/intel_th/core.c +0 -1
@@ -1048,7 +1048,6 @@ int intel_th_set_output(struct intel_th_device *thdev,
 	 * hub is instantiated together with the source device that
 	 * calls here, so guaranteed to be present.
 	 */
-	hubdrv = to_intel_th_driver(hub->dev.driver);
 	if (!hubdrv || !try_module_get(hubdrv->driver.owner))
            ^^^^^^^

This NULL check doesn't make sense. "hubdrv" is "hub - some_offset" where "some_offset" is zero. We've already dereferenced "hub" so "hubdrv" can't be NULL.

regards,
dan carpenter