You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
Diff
39 lines
1.1 KiB
Diff
From 1ccc18ca96d8a824f2af45d1046d23ccdb90f3df Mon Sep 17 00:00:00 2001
|
|
From: Anji Jagarlmudi <anji.jagarlmudi@nxp.com>
|
|
Date: Wed, 8 Jan 2020 12:18:40 +0530
|
|
Subject: [PATCH] staging: fsl_ppfe/eth: Enhance error checking in platform
|
|
probe
|
|
|
|
Fix the kernel crash when MAC addr is not passed in dtb.
|
|
|
|
Signed-off-by: Anji Jagarlmudi <anji.jagarlmudi@nxp.com>
|
|
---
|
|
drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c | 10 +++++++---
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
--- a/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
|
|
+++ b/drivers/staging/fsl_ppfe/pfe_ls1012a_platform.c
|
|
@@ -29,15 +29,19 @@ static int pfe_get_gemac_if_properties(s
|
|
int size;
|
|
int phy_id = 0;
|
|
const u32 *addr;
|
|
- const void *mac_addr;
|
|
+ const u8 *mac_addr;
|
|
|
|
addr = of_get_property(gem, "reg", &size);
|
|
- port = be32_to_cpup(addr);
|
|
+ if (addr)
|
|
+ port = be32_to_cpup(addr);
|
|
+ else
|
|
+ goto err;
|
|
+
|
|
|
|
pdata->ls1012a_eth_pdata[port].gem_id = port;
|
|
|
|
mac_addr = of_get_mac_address(gem);
|
|
- if (mac_addr) {
|
|
+ if (!IS_ERR_OR_NULL(mac_addr)) {
|
|
memcpy(pdata->ls1012a_eth_pdata[port].mac_addr, mac_addr,
|
|
ETH_ALEN);
|
|
}
|