Skip to contentSkip to conversation

i2c: i801: Fix using mux_pdev before it's set

PATCH Applied Heiner Kallweit 2 participants 3 messages Mar 3, 2024 – Mar 6, 2024

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

PATCH v2 1/1 i2c: i801: Fix using mux_pdev before it's set

i801_probe_optional_slaves() is called before i801_add_mux(). This results in mux_pdev being checked before it's set by i801_add_mux(). Fix this by changing the order of the calls. I consider this safe as I see no dependencies.

Fixes 80e56b86b59e ("i2c: i801: Simplify class-based client device instantiation")

---
v2:
- cc stable

---
 drivers/i2c/busses/i2c-i801.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-i801.c +1 -1
index 223cd2b84..8e95db95c 100644
@@ -1762,9 +1762,9 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 
 	i801_enable_host_notify(&priv->adapter);
 
-	i801_probe_optional_slaves(priv);
 	/* We ignore errors - multiplexing is optional */
 	i801_add_mux(priv);
+	i801_probe_optional_slaves(priv);
 
 	pci_set_drvdata(dev, priv);
 
Signature · 1 line
2.43.2
maintainer Reviewed-by on v2 1/1
#1 lore raw

Hi Heiner,

Quoted 8 lines · Heiner Kallweit

i801_probe_optional_slaves() is called before i801_add_mux(). This results in mux_pdev being checked before it's set by i801_add_mux(). Fix this by changing the order of the calls. I consider this safe as I see no dependencies.

Fixes 80e56b86b59e ("i2c: i801: Simplify class-based client device instantiation")

Thanks,
Andi

maintainer Applied
#2 lore raw
In reply to Heiner Kallweit

Hi

Quoted 6 lines · Heiner Kallweit

i801_probe_optional_slaves() is called before i801_add_mux(). This results in mux_pdev being checked before it's set by i801_add_mux(). Fix this by changing the order of the calls. I consider this safe as I see no dependencies.

Applied to i2c/i2c-host-fixes on

git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

Thank you,
Andi

Patches applied
===============
[1/1] i2c: i801: Fix using mux_pdev before it's set

      commit: b60b86b55400413e5f2f1c076f5a2f535341c9ce