summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaeseok Youn <daeseok.youn@gmail.com>2016-04-05 18:29:43 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-29 17:46:00 -0700
commit16f10a825da5b9361ef8e8da76720c37f0116da4 (patch)
treeba2672ec6d79d0f58a2f99884e336c6be6732f71 /drivers
parent6b3752d8ce67dc62150db9d153e72c7a98db4007 (diff)
downloadblackbird-op-linux-16f10a825da5b9361ef8e8da76720c37f0116da4.tar.gz
blackbird-op-linux-16f10a825da5b9361ef8e8da76720c37f0116da4.zip
staging: dgnc: return -ENOMEM when kzalloc failed
The kzalloc can be failed when memory is not enough to allocate. When kzalloc failed, it need to return error code with ENOMEM Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/dgnc/dgnc_tty.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 5832190c5ded..7f73a4104ec3 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -1106,6 +1106,14 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
if (!ch->ch_wqueue)
ch->ch_wqueue = kzalloc(WQUEUESIZE, GFP_KERNEL);
+ if (!ch->ch_rqueue || !ch->ch_equeue || !ch->ch_wqueue) {
+ kfree(ch->ch_rqueue);
+ kfree(ch->ch_equeue);
+ kfree(ch->ch_wqueue);
+
+ return -ENOMEM;
+ }
+
spin_lock_irqsave(&ch->ch_lock, flags);
ch->ch_flags &= ~(CH_OPENING);
OpenPOWER on IntegriCloud