net: ena: fix error returning in ena_com_get_hash_function()
authorArthur Kiyanovski <akiyano@amazon.com>
Sun, 3 May 2020 09:52:11 +0000 (09:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:30:51 +0000 (09:30 +0200)
commitfa15b59b1ea2fdb30c5532d6bbf8e11c9c1b1a38
tree9a2ba6218bccc58387667a8dff7a94582fbcbef4
parent84c8498320d2877369273ec84105ed5666cfc37f
net: ena: fix error returning in ena_com_get_hash_function()

[ Upstream commit e9a1de378dd46375f9abfd8de1e6f59ee114a793 ]

In case the "func" parameter is NULL we now return "-EINVAL".
This shouldn't happen in general, but when it does happen, this is the
proper way to handle it.

We also check func for NULL in the beginning of the function, as there
is no reason to do all the work and realize in the end of the function
it was useless.

Signed-off-by: Sameeh Jubran <sameehj@amazon.com>
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/amazon/ena/ena_com.c