From patchwork Tue Feb 11 23:13:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Heiny X-Patchwork-Id: 3633331 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7B9C1BF13A for ; Tue, 11 Feb 2014 23:13:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6774B201F2 for ; Tue, 11 Feb 2014 23:13:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DC6320149 for ; Tue, 11 Feb 2014 23:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751674AbaBKXNG (ORCPT ); Tue, 11 Feb 2014 18:13:06 -0500 Received: from us-mx2.synaptics.com ([192.147.44.131]:16052 "EHLO us-mx2.synaptics.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbaBKXNF (ORCPT ); Tue, 11 Feb 2014 18:13:05 -0500 Received: from unknown (HELO securemail.synaptics.com) ([172.20.21.135]) by us-mx2.synaptics.com with ESMTP; 11 Feb 2014 15:13:05 -0800 Received: from USW-OWA1.synaptics-inc.local ([10.20.24.16]) by securemail.synaptics.com (PGP Universal service); Tue, 11 Feb 2014 15:00:32 -0800 X-PGP-Universal: processed; by securemail.synaptics.com on Tue, 11 Feb 2014 15:00:32 -0800 Received: from brontomerus.synaptics.com (10.3.20.103) by USW-OWA1.synaptics-inc.local (10.20.24.15) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 11 Feb 2014 15:13:28 -0800 From: Christopher Heiny To: Dmitry Torokhov CC: Linux Input , Christopher Heiny , Andrew Duggan , Vincent Huang , Vivian Ly , Daniel Rosenberg , Jean Delvare , Joerie de Gram , Linus Walleij , Benjamin Tissoires , David Herrmann , Jiri Kosina Subject: [PATCH] input synaptics-rmi4: rmi_f01.c storage fix Date: Tue, 11 Feb 2014 15:13:00 -0800 Message-ID: <1392160380-8221-1-git-send-email-cheiny@synaptics.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.3.20.103] X-Brightmail-Tracker: AAAAAQAAAWE= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Correctly free driver related data when initialization fails. Trivial: Clarify a diagnostic message. Signed-off-by: Christopher Heiny Cc: Dmitry Torokhov Cc: Benjamin Tissoires Cc: Linux Walleij Cc: David Herrmann Cc: Jiri Kosina --- drivers/input/rmi4/rmi_f01.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c index 381ad60..e4a6df9 100644 --- a/drivers/input/rmi4/rmi_f01.c +++ b/drivers/input/rmi4/rmi_f01.c @@ -149,7 +149,7 @@ static int rmi_f01_alloc_memory(struct rmi_function *fn, f01 = devm_kzalloc(&fn->dev, sizeof(struct f01_data), GFP_KERNEL); if (!f01) { - dev_err(&fn->dev, "Failed to allocate fn_01_data.\n"); + dev_err(&fn->dev, "Failed to allocate f01_data.\n"); return -ENOMEM; } @@ -158,6 +158,7 @@ static int rmi_f01_alloc_memory(struct rmi_function *fn, GFP_KERNEL); if (!f01->device_control.interrupt_enable) { dev_err(&fn->dev, "Failed to allocate interrupt enable.\n"); + devm_kfree(&fn->dev, f01); return -ENOMEM; } fn->data = f01; @@ -381,7 +382,8 @@ static int rmi_f01_initialize(struct rmi_function *fn) return 0; error_exit: - kfree(data); + devm_kfree(&fn->dev, data->device_control.interrupt_enable); + devm_kfree(&fn->dev, data); return error; }