Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753319AbbDGK1e (ORCPT ); Tue, 7 Apr 2015 06:27:34 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:36560 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752721AbbDGK1b (ORCPT ); Tue, 7 Apr 2015 06:27:31 -0400 From: =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= To: lidza.louina@gmail.com, markh@compro.net Cc: gregkh@linuxfoundation.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Giedrius=20Statkevi=C4=8Dius?= Subject: [PATCH] staging: dgnc: check if kzalloc fails in dgnc_tty_init() Date: Tue, 7 Apr 2015 13:26:32 +0300 Message-Id: <1428402392-15817-1-git-send-email-giedrius.statkevicius@gmail.com> X-Mailer: git-send-email 2.3.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 951 Lines: 29 kzalloc() could fail so add a check and return -ENOMEM if it does that gets propogated to the pci layer Signed-off-by: Giedrius Statkevičius --- drivers/staging/dgnc/dgnc_tty.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 61d5a8e..23337da 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -311,6 +311,8 @@ int dgnc_tty_init(struct dgnc_board *brd) * interrupt context, and there are no locks held. */ brd->channels[i] = kzalloc(sizeof(*brd->channels[i]), GFP_KERNEL); + if (!brd->channels[i]) + return -ENOMEM; } } -- 2.3.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/