forked from openbmc/openbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
npcm7xx: fix error handling in the emc driver
This fixes a kernel crash if the mac address is not set.
- Loading branch information
1 parent
6a53297
commit 77e9f58
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
meta-nuvoton/recipes-kernel/linux/linux-nuvoton/npcm7xx_emc-is_err-fix.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From 95c9299759e5ddd71ccea042a27135aae44bbaaf Mon Sep 17 00:00:00 2001 | ||
From: Havard Skinnemoen <hskinnemoen@google.com> | ||
Date: Fri, 10 Jul 2020 22:35:05 -0700 | ||
Subject: [PATCH] npcm7xx_emc: Use IS_ERR instead of NULL check | ||
|
||
of_get_mac_address returns ERR_PTR on error, not NULL. | ||
|
||
Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com> | ||
--- | ||
drivers/net/ethernet/nuvoton/npcm7xx_emc.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/drivers/net/ethernet/nuvoton/npcm7xx_emc.c b/drivers/net/ethernet/nuvoton/npcm7xx_emc.c | ||
index efb441d511c5..41c7f814a9c3 100644 | ||
--- a/drivers/net/ethernet/nuvoton/npcm7xx_emc.c | ||
+++ b/drivers/net/ethernet/nuvoton/npcm7xx_emc.c | ||
@@ -1753,7 +1753,7 @@ static void get_mac_address(struct net_device *dev) | ||
|
||
mac_address = of_get_mac_address(np); | ||
|
||
- if (mac_address != 0) | ||
+ if (!IS_ERR(mac_address)) | ||
ether_addr_copy(dev->dev_addr, mac_address); | ||
|
||
if (is_valid_ether_addr(dev->dev_addr)) { | ||
-- | ||
2.27.0.383.g050319c2ae-goog | ||
|