of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <redacted>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)inti;match=of_match_device(of_mtk_match,&pdev->dev);+if(!match){+dev_err(&pdev->dev,"Error: No device match found\n");+return-ENODEV;+}soc=(structmtk_soc_data*)match->data;eth=devm_kzalloc(&pdev->dev,sizeof(*eth),GFP_KERNEL);
On Fri, Jan 27, 2017 at 04:49:40PM +0530, Shailendra Verma wrote:
quoted hunk
of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <redacted>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)inti;match=of_match_device(of_mtk_match,&pdev->dev);+if(!match){+dev_err(&pdev->dev,"Error: No device match found\n");+return-ENODEV;+}soc=(structmtk_soc_data*)match->data;eth=devm_kzalloc(&pdev->dev,sizeof(*eth),GFP_KERNEL);
--
Hello
You could use of_device_get_match_data() and simplifiy code
Regards
Corentin Labbe
On Fri, Jan 27, 2017 at 04:49:40PM +0530, Shailendra Verma wrote:
quoted
of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <redacted>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -2369,6 +2369,10 @@ static int mtk_probe(struct platform_device *pdev)inti;match=of_match_device(of_mtk_match,&pdev->dev);+if(!match){+dev_err(&pdev->dev,"Error: No device match found\n");+return-ENODEV;+}soc=(structmtk_soc_data*)match->data;eth=devm_kzalloc(&pdev->dev,sizeof(*eth),GFP_KERNEL);
--
Hello
You could use of_device_get_match_data() and simplifiy code