tty: atmel_serial: fix a potential NULL pointer dereference
authorKangjie Lu <kjlu@umn.edu>
Fri, 15 Mar 2019 17:16:06 +0000 (12:16 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2019 04:26:24 +0000 (06:26 +0200)
commitb9bbd1edddf74701d51a50ca476fa7101655b693
tree6a80773717da1136cc00e4ec7b69df0c35642b04
parent124e42064c0dcbc0a260d0e18ed2410976422c54
tty: atmel_serial: fix a potential NULL pointer dereference

commit c85be041065c0be8bc48eda4c45e0319caf1d0e5 upstream.

In case dmaengine_prep_dma_cyclic fails, the fix returns a proper
error code to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Fixes: 34df42f59a60 ("serial: at91: add rx dma support")
Acked-by: Richard Genoud <richard.genoud@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/atmel_serial.c