mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 07:31:15 +00:00
net: core: avoid possible NULL pointer dereference
Checking if dev is NULL after dereferencing it does not make sense. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
96d1d84c79
commit
c08248d601
1 changed files with 2 additions and 1 deletions
|
@ -181,7 +181,7 @@ int eth_get_dev_index(void)
|
|||
|
||||
static int eth_write_hwaddr(struct udevice *dev)
|
||||
{
|
||||
struct eth_pdata *pdata = dev->platdata;
|
||||
struct eth_pdata *pdata;
|
||||
int ret = 0;
|
||||
|
||||
if (!dev || !device_active(dev))
|
||||
|
@ -189,6 +189,7 @@ static int eth_write_hwaddr(struct udevice *dev)
|
|||
|
||||
/* seq is valid since the device is active */
|
||||
if (eth_get_ops(dev)->write_hwaddr && !eth_mac_skip(dev->seq)) {
|
||||
pdata = dev->platdata;
|
||||
if (!is_valid_ethaddr(pdata->enetaddr)) {
|
||||
printf("\nError: %s address %pM illegal value\n",
|
||||
dev->name, pdata->enetaddr);
|
||||
|
|
Loading…
Reference in a new issue