net: qca_spi: Fix possible race during probe
Registering the netdev before setting the priv data is unsafe.
So fix this possible race by setting the priv data first.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Cc: <stable@vger.kernel.org> # v3.18+
Fixes: 291ab06e
(net: qualcomm: new Ethernet over SPI driver for QCA7000)
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7c0c826828
commit
268be0f7a7
|
@ -912,6 +912,8 @@ qca_spi_probe(struct spi_device *spi_device)
|
||||||
qca->spi_dev = spi_device;
|
qca->spi_dev = spi_device;
|
||||||
qca->legacy_mode = legacy_mode;
|
qca->legacy_mode = legacy_mode;
|
||||||
|
|
||||||
|
spi_set_drvdata(spi_device, qcaspi_devs);
|
||||||
|
|
||||||
mac = of_get_mac_address(spi_device->dev.of_node);
|
mac = of_get_mac_address(spi_device->dev.of_node);
|
||||||
|
|
||||||
if (mac)
|
if (mac)
|
||||||
|
@ -944,8 +946,6 @@ qca_spi_probe(struct spi_device *spi_device)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
spi_set_drvdata(spi_device, qcaspi_devs);
|
|
||||||
|
|
||||||
qcaspi_init_device_debugfs(qca);
|
qcaspi_init_device_debugfs(qca);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue