net: fm: NULL check dev before dereference
In fm_eth_bind there is a dereference of dev before it is NULL checked. Add a NULL check before the first dereference and remove a later NULL check that is now redundant. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Signed-off-by: Peng Fan <peng.fan@nxp.com>
This commit is contained in:
committed by
Peng Fan
parent
44d321f009
commit
270798a420
@@ -727,12 +727,15 @@ static int fm_eth_bind(struct udevice *dev)
|
||||
char mac_name[11];
|
||||
u32 fm, num;
|
||||
|
||||
if (!dev)
|
||||
return -EINVAL;
|
||||
|
||||
if (ofnode_read_u32(ofnode_get_parent(dev_ofnode(dev)), "cell-index", &fm)) {
|
||||
printf("FMan node property cell-index missing\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (dev && dev_read_u32(dev, "cell-index", &num)) {
|
||||
if (dev_read_u32(dev, "cell-index", &num)) {
|
||||
printf("FMan MAC node property cell-index missing\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user