Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16f10a82 authored by Daeseok Youn's avatar Daeseok Youn Committed by Greg Kroah-Hartman
Browse files

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: default avatarDaeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6b3752d8
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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);