mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 04:42:04 -04:00
fsl/fman: fix dereference null return value
[ Upstream commit 0572054617f32670abab4b4e89a876954d54b704 ]
Check before using returned value to avoid dereferencing null pointer.
Fixes: 18a6c85fcc ("fsl/fman: Add FMan Port Support")
Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
e9b3249a3d
commit
a405fb3ffd
1 changed files with 8 additions and 1 deletions
|
|
@ -1756,6 +1756,7 @@ static int fman_port_probe(struct platform_device *of_dev)
|
|||
struct fman_port *port;
|
||||
struct fman *fman;
|
||||
struct device_node *fm_node, *port_node;
|
||||
struct platform_device *fm_pdev;
|
||||
struct resource res;
|
||||
struct resource *dev_res;
|
||||
u32 val;
|
||||
|
|
@ -1780,8 +1781,14 @@ static int fman_port_probe(struct platform_device *of_dev)
|
|||
goto return_err;
|
||||
}
|
||||
|
||||
fman = dev_get_drvdata(&of_find_device_by_node(fm_node)->dev);
|
||||
fm_pdev = of_find_device_by_node(fm_node);
|
||||
of_node_put(fm_node);
|
||||
if (!fm_pdev) {
|
||||
err = -EINVAL;
|
||||
goto return_err;
|
||||
}
|
||||
|
||||
fman = dev_get_drvdata(&fm_pdev->dev);
|
||||
if (!fman) {
|
||||
err = -EINVAL;
|
||||
goto return_err;
|
||||
|
|
|
|||
Loading…
Reference in a new issue