From patchwork Mon Jan 12 10:07:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 5609381 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F346B9F2ED for ; Mon, 12 Jan 2015 10:08:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D92320480 for ; Mon, 12 Jan 2015 10:08:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3E64203EC for ; Mon, 12 Jan 2015 10:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752733AbbALKIE (ORCPT ); Mon, 12 Jan 2015 05:08:04 -0500 Received: from andre.telenet-ops.be ([195.130.132.53]:39132 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752739AbbALKIC (ORCPT ); Mon, 12 Jan 2015 05:08:02 -0500 Received: from ayla.of.borg ([84.193.93.87]) by andre.telenet-ops.be with bizsmtp id ey7z1p0111t5w8s01y7zmd; Mon, 12 Jan 2015 11:07:59 +0100 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1YAbuh-0003l2-CU; Mon, 12 Jan 2015 11:07:59 +0100 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1YAbuk-0004C5-Nh; Mon, 12 Jan 2015 11:08:02 +0100 From: Geert Uytterhoeven To: Linus Walleij , Alexandre Courbot Cc: Magnus Damm , linux-gpio@vger.kernel.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 1/2] gpio: rcar: Fix error path for devm_kzalloc() failure Date: Mon, 12 Jan 2015 11:07:58 +0100 Message-Id: <1421057279-16081-2-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421057279-16081-1-git-send-email-geert+renesas@glider.be> References: <1421057279-16081-1-git-send-email-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 If the call to devm_kzalloc() fails, nothing must be cleant up. This was missed before because gpio_rcar_probe() had a "return" statement after the first "goto err0". Signed-off-by: Geert Uytterhoeven Fixes: df0c6c80232f2ad4 ("gpio: rcar: Add minimal runtime PM support") --- drivers/gpio/gpio-rcar.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 584484e3f1e3cd1d..ca2b6310f8f709d3 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -372,10 +372,8 @@ static int gpio_rcar_probe(struct platform_device *pdev) int ret; p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); - if (!p) { - ret = -ENOMEM; - goto err0; - } + if (!p) + return -ENOMEM; p->pdev = pdev; spin_lock_init(&p->lock);