]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i2c: i801: Fix using mux_pdev before it's set
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 3 Mar 2024 10:45:22 +0000 (11:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:41 +0000 (15:11 +0200)
commit 09f02902eb9cd41d4b88f4a5b93696297b57a3b0 upstream.

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")
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-i801.c

index 6a5a93cf4ecc6413b1d0018ad782a053a0a8f825..8efcd723bacdd957e360f3881f5ea79aa1cc6fe3 100644 (file)
@@ -1740,9 +1740,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);