net: WIZnet drivers: fix possible NULL dereference

This fixes possible null dereference in probe() function: when both
.mac_addr and .link_gpio are unknown, dev.platform_data may be NULL

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mike Sinkovsky <msink@permonline.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Mike Sinkovsky 2012-04-10 19:53:53 +00:00 committed by David S. Miller
parent 9b17876f3e
commit 77577bf932
2 changed files with 2 additions and 2 deletions

View File

@ -682,7 +682,7 @@ static int __devinit w5100_hw_probe(struct platform_device *pdev)
return ret;
priv->irq = irq;
priv->link_gpio = data->link_gpio;
priv->link_gpio = data ? data->link_gpio : -EINVAL;
if (gpio_is_valid(priv->link_gpio)) {
char *link_name = devm_kzalloc(&pdev->dev, 16, GFP_KERNEL);
if (!link_name)

View File

@ -594,7 +594,7 @@ static int __devinit w5300_hw_probe(struct platform_device *pdev)
return ret;
priv->irq = irq;
priv->link_gpio = data->link_gpio;
priv->link_gpio = data ? data->link_gpio : -EINVAL;
if (gpio_is_valid(priv->link_gpio)) {
char *link_name = devm_kzalloc(&pdev->dev, 16, GFP_KERNEL);
if (!link_name)