From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934035AbcAYRrs (ORCPT ); Mon, 25 Jan 2016 12:47:48 -0500 Received: from mail-pf0-f174.google.com ([209.85.192.174]:33678 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932942AbcAYRrp (ORCPT ); Mon, 25 Jan 2016 12:47:45 -0500 From: Aniroop Mathur To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, aniroop.mathur@gmail.com, Aniroop Mathur Subject: [PATCH] Input: evdev: correct handling of memory allocation failure of evdev_client Date: Mon, 25 Jan 2016 23:20:05 +0530 Message-Id: <1453744205-868-1-git-send-email-a.mathur@samsung.com> X-Mailer: git-send-email 2.6.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lets fix twice checking of memory allocation failure of evdev_client structure when allocated successfully. Signed-off-by: Aniroop Mathur --- drivers/input/evdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index e9ae3d5..102b5d9 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -503,10 +503,11 @@ static int evdev_open(struct inode *inode, struct file *file) int error; client = kzalloc(size, GFP_KERNEL | __GFP_NOWARN); - if (!client) + if (!client) { client = vzalloc(size); - if (!client) - return -ENOMEM; + if (!client) + return -ENOMEM; + } client->bufsize = bufsize; spin_lock_init(&client->buffer_lock); -- 2.6.2