diff options
author | Zhang Changzhong <zhangchangzhong@huawei.com> | 2020-12-04 16:49:42 +0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-12-05 14:04:55 -0800 |
commit | 4de377b659035309ba48638d70f3150d5c67611f (patch) | |
tree | 2884c06ce84681e1f85b490c5d73e73b5a264049 /drivers/net | |
parent | 205704c618af0ab2366015d2281a3b0814d918a0 (diff) |
net: marvell: prestera: Fix error return code in prestera_port_create()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.
Fixes: 501ef3066c89 ("net: marvell: prestera: Add driver for Prestera family ASIC devices")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Link: https://lore.kernel.org/r/1607071782-34006-1-git-send-email-zhangchangzhong@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/marvell/prestera/prestera_main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index 0f20e0788cce..da4b286d1337 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -318,8 +318,10 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id) goto err_port_init; } - if (port->fp_id >= PRESTERA_MAC_ADDR_NUM_MAX) + if (port->fp_id >= PRESTERA_MAC_ADDR_NUM_MAX) { + err = -EINVAL; goto err_port_init; + } /* firmware requires that port's MAC address consist of the first * 5 bytes of the base MAC address |