* [PATCH net] net: marvell: prestera: Fix error return code in prestera_port_create()
@ 2020-12-04 8:49 Zhang Changzhong
2020-12-05 22:34 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Zhang Changzhong @ 2020-12-04 8:49 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Oleksandr Mazur, Serhiy Pshyk,
Vadym Kochan, Volodymyr Mytnyk
Cc: Zhang Changzhong, netdev, linux-kernel
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>
---
drivers/net/ethernet/marvell/prestera/prestera_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index 0f20e07..da4b286 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
--
2.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: marvell: prestera: Fix error return code in prestera_port_create()
2020-12-04 8:49 [PATCH net] net: marvell: prestera: Fix error return code in prestera_port_create() Zhang Changzhong
@ 2020-12-05 22:34 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-12-05 22:34 UTC (permalink / raw)
To: Zhang Changzhong
Cc: David S. Miller, Oleksandr Mazur, Serhiy Pshyk, Vadym Kochan,
Volodymyr Mytnyk, netdev, linux-kernel
On Fri, 4 Dec 2020 16:49:42 +0800 Zhang Changzhong wrote:
> 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>
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-05 22:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 8:49 [PATCH net] net: marvell: prestera: Fix error return code in prestera_port_create() Zhang Changzhong
2020-12-05 22:34 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).