ethernet: handle return value properly

Improper handling of return value is causing below crash.

[    2.278898] Unable to handle kernel paging request at virtual address fffffffffffffffe
[    2.287262] Mem abort info:
[    2.289874]   ESR = 0x96000006
[    2.292957]   EC = 0x25: DABT (current EL), IL = 32 bits
[    2.298463]   SET = 0, FnV = 0
[    2.301418]   EA = 0, S1PTW = 0
[    2.304411] Data abort info:
[    2.307042]   ISV = 0, ISS = 0x00000006
[    2.310886]   CM = 0, WnR = 0
[    2.313845] swapper pgtable: 64k pages, 48-bit VAs, pgdp=0000000081710000
[    2.320348] [fffffffffffffffe] pgd=0000000081f50003, pud=0000000081f50003, pmd=0000000000000000
[    2.328919] Internal error: Oops: 96000006 [#1] PREEMPT SMP
[    2.334315] Modules linked in:
[    2.337471] CPU: 6 PID: 1 Comm: swapper/0 Not tainted 5.7.0-tegra #15
[    2.343595] Hardware name: e3550_t194a (DT)
[    2.347800] pstate: 60c00009 (nZCv daif +PAN +UAO)
[    2.352876] pc : ether_probe+0xf84/0x2290
[    2.356981] lr : ether_probe+0xf80/0x2290
[    2.361111] sp : ffff80001218fa70
[    2.364071] x29: ffff80001218fa70 x28: 0000000000000000
[    2.369754] x27: ffff0007c0c1b880 x26: ffff800011591000
[    2.375008] x25: ffff800011177a60 x24: ffff800011591198
[    2.380516] x23: ffff0007c0e8c080 x22: ffff0007c0bee010
[    2.385772] x21: ffff0007c0bee000 x20: ffff800011177000
[    2.391541] x19: ffff800011d15000 x18: ffffffffffffffff
[    2.396620] x17: 0000000000000068 x16: 0000000000000000
[    2.402216] x15: ffff800011d15948 x14: ffff80009218f7c7
[    2.407382] x13: ffff80001218f7d5 x12: ffff800011d2e000
[    2.413065] x11: 0000000005f5e0ff x10: ffff800011d161b8
[    2.418321] x9 : ffff800011890018 x8 : 0000000000000000
[    2.423741] x7 : 0000000000000107 x6 : 000000000000000a
[    2.428822] x5 : 0000000000000003 x4 : fffffffffffffffe
[    2.434527] x3 : 00000000ffffffff x2 : eaa4d7f4484fe300
[    2.439582] x1 : 0000000000000000 x0 : 0000000000000017
[    2.445201] Call trace:
[    2.447638]  ether_probe+0xf84/0x2290
[    2.451157]  platform_drv_probe+0x54/0xa8
[    2.455334]  really_probe+0x110/0x368
[    2.458855]  driver_probe_device+0x5c/0x108
[    2.462856]  device_driver_attach+0x74/0x80
[    2.467056]  __driver_attach+0x8c/0xd8
[    2.470561]  bus_for_each_dev+0x7c/0xd8
[    2.474582]  driver_attach+0x24/0x30
[    2.478081]  bus_add_driver+0x154/0x200
[    2.481764]  driver_register+0x64/0x120
[    2.485783]  __platform_driver_register+0x44/0x50
[    2.490335]  ether_driver_init+0x1c/0x28
[    2.493837]  do_one_initcall+0x60/0x1c0
[    2.498033]  kernel_init_freeable+0x1fc/0x268
[    2.502063]  kernel_init+0x14/0x110
[    2.505561]  ret_from_fork+0x10/0x1c
[    2.509242] Code: b0005820 9106c000 97daf772 f9406fa4 (b9400081)
[    2.515200] ---[ end trace 790e8c45a4a3892a ]---
[    2.519962] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    2.527641] SMP: stopping secondary CPUs
[    2.531822] Kernel Offset: disabled
[    2.535481] CPU features: 0x080002,2300aa30
[    2.539502] Memory Limit: none
[    2.542576] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

Change-Id: I5a526033fc4537886e004561eda2d6c494782bd3
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2371138
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Manish Bhardwaj
2020-07-06 14:34:32 +05:30
committed by Revanth Kumar Uppala
parent 89b049c619
commit 45a2dfb57b

View File

@@ -3277,7 +3277,7 @@ static int ether_get_mac_address(struct ether_priv_data *pdata)
if (!osi_core->pre_si) {
/* read MAC address */
eth_mac_addr = of_get_mac_address(np);
if (!eth_mac_addr) {
if (IS_ERR_OR_NULL(eth_mac_addr)) {
ret = ether_get_mac_address_dtb("/chosen",
"nvidia,ether-mac",
mac_addr);