OSDN Git Service

can: rx-offload: can_rx_offload_offload_one(): use ERR_PTR() to propagate error value...
authorMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 9 Oct 2019 19:00:32 +0000 (21:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 08:19:42 +0000 (09:19 +0100)
commiteca4b786f3bb39ae56a4af8475c71056b4264706
treee1e0b869cce47f84ad6353c94094f933afc51de3
parenta85ce0107d6bd14f78424de2fac4420d46f15d4e
can: rx-offload: can_rx_offload_offload_one(): use ERR_PTR() to propagate error value in case of errors

[ Upstream commit d763ab3044f0bf50bd0e6179f6b2cf1c125d1d94 ]

Before this patch can_rx_offload_offload_one() returns a pointer to a
skb containing the read CAN frame or a NULL pointer.

However the meaning of the NULL pointer is ambiguous, it can either mean
the requested mailbox is empty or there was an error.

This patch fixes this situation by returning:
- pointer to skb on success
- NULL pointer if mailbox is empty
- ERR_PTR() in case of an error

All users of can_rx_offload_offload_one() have been adopted, no
functional change intended.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/rx-offload.c