mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
net: phy: phy driver features are mandatory
Since phy driver features became a link_mode bitmap, phy drivers that
don't have a list of features configured will cause the kernel to crash
when probed.
Prevent the phy driver from registering if the features field is missing.
Fixes: 719655a149
("net: phy: Replace phy driver features u32 with link_mode bitmap")
Reported-by: Scott Wood <oss@buserror.net>
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7afa81c55f
commit
3e64cf7a43
2 changed files with 7 additions and 2 deletions
|
@ -2255,6 +2255,11 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
|
if (WARN_ON(!new_driver->features)) {
|
||||||
|
pr_err("%s: Driver features are missing\n", new_driver->name);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
new_driver->mdiodrv.flags |= MDIO_DEVICE_IS_PHY;
|
new_driver->mdiodrv.flags |= MDIO_DEVICE_IS_PHY;
|
||||||
new_driver->mdiodrv.driver.name = new_driver->name;
|
new_driver->mdiodrv.driver.name = new_driver->name;
|
||||||
new_driver->mdiodrv.driver.bus = &mdio_bus_type;
|
new_driver->mdiodrv.driver.bus = &mdio_bus_type;
|
||||||
|
|
|
@ -469,8 +469,8 @@ struct phy_device {
|
||||||
* only works for PHYs with IDs which match this field
|
* only works for PHYs with IDs which match this field
|
||||||
* name: The friendly name of this PHY type
|
* name: The friendly name of this PHY type
|
||||||
* phy_id_mask: Defines the important bits of the phy_id
|
* phy_id_mask: Defines the important bits of the phy_id
|
||||||
* features: A list of features (speed, duplex, etc) supported
|
* features: A mandatory list of features (speed, duplex, etc)
|
||||||
* by this PHY
|
* supported by this PHY
|
||||||
* flags: A bitfield defining certain other features this PHY
|
* flags: A bitfield defining certain other features this PHY
|
||||||
* supports (like interrupts)
|
* supports (like interrupts)
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue