Skip to contentSkip to conversation

i2c: amd-mp2: clean up amd_mp2_find_device()

PATCH Applied Johan Hovold 3 participants 3 messages Dec 10, 2025 – Jan 16

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

PATCH v2 1/1 i2c: amd-mp2: clean up amd_mp2_find_device()

Rename the driver data pointer for consistency with the rest of the driver and drop a redundant cast.

---

Changes in v2
- rebase [1] on current mainline where the reference leak has already been fixed and update the commit message to reflect that this is now only a cleanup

[1] https://lore.kernel.org/lkml/[email protected]/

 drivers/i2c/busses/i2c-amd-mp2-pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-amd-mp2-pci.c +5 -3
index 60edbabc2986..5b41d18b62d3 100644
@@ -456,18 +456,20 @@ module_pci_driver(amd_mp2_pci_driver);
 
 struct amd_mp2_dev *amd_mp2_find_device(void)
 {
+	struct amd_mp2_dev *privdata;
 	struct device *dev;
 	struct pci_dev *pci_dev;
-	struct amd_mp2_dev *mp2_dev;
 
 	dev = driver_find_next_device(&amd_mp2_pci_driver.driver, NULL);
 	if (!dev)
 		return NULL;
 
 	pci_dev = to_pci_dev(dev);
-	mp2_dev = (struct amd_mp2_dev *)pci_get_drvdata(pci_dev);
+	privdata = pci_get_drvdata(pci_dev);
+
 	put_device(dev);
-	return mp2_dev;
+
+	return privdata;
 }
 EXPORT_SYMBOL_GPL(amd_mp2_find_device);
 
Signature · 1 line
2.52.0
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 4 lines · Johan Hovold

Rename the driver data pointer for consistency with the rest of the driver and drop a redundant cast.

Thanks,
Shyam

Quoted 41 lines

---

Changes in v2
- rebase [1] on current mainline where the reference leak has already been fixed and update the commit message to reflect that this is now only a cleanup

[1] https://lore.kernel.org/lkml/[email protected]/

 drivers/i2c/busses/i2c-amd-mp2-pci.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-amd-mp2-pci.c +5 -3
index 60edbabc2986..5b41d18b62d3 100644
@@ -456,18 +456,20 @@ module_pci_driver(amd_mp2_pci_driver);
 
 struct amd_mp2_dev *amd_mp2_find_device(void)
 {
+	struct amd_mp2_dev *privdata;
 	struct device *dev;
 	struct pci_dev *pci_dev;
-	struct amd_mp2_dev *mp2_dev;
 
 	dev = driver_find_next_device(&amd_mp2_pci_driver.driver, NULL);
 	if (!dev)
 		return NULL;
 
 	pci_dev = to_pci_dev(dev);
-	mp2_dev = (struct amd_mp2_dev *)pci_get_drvdata(pci_dev);
+	privdata = pci_get_drvdata(pci_dev);
+
 	put_device(dev);
-	return mp2_dev;
+
+	return privdata;
 }
 EXPORT_SYMBOL_GPL(amd_mp2_find_device);