summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-04-21 16:51:48 +0300
committerDavid S. Miller <davem@davemloft.net>2022-04-25 13:24:41 +0300
commit60d78e9fce8886b403a21fecb0dd13f9c0f12e1f (patch)
tree9dc98bccbe146066b20abf33ed51fe8233d91059
parent985e254c738ce735d744beeb4bcf77ba7d81cf3a (diff)
downloadlinux-60d78e9fce8886b403a21fecb0dd13f9c0f12e1f.tar.xz
ethernet: broadcom/sb1250-mac: remove BUG_ON in sbmac_probe()
Replace the BUG_ON() with returning error code to handle the fault more gracefully. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/sb1250-mac.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
index a1a38456c9a3..5d5f10180158 100644
--- a/drivers/net/ethernet/broadcom/sb1250-mac.c
+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
@@ -2534,7 +2534,12 @@ static int sbmac_probe(struct platform_device *pldev)
int err;
res = platform_get_resource(pldev, IORESOURCE_MEM, 0);
- BUG_ON(!res);
+ if (!res) {
+ printk(KERN_ERR "%s: failed to get resource\n",
+ dev_name(&pldev->dev));
+ err = -EINVAL;
+ goto out_out;
+ }
sbm_base = ioremap(res->start, resource_size(res));
if (!sbm_base) {
printk(KERN_ERR "%s: unable to map device registers\n",