From patchwork Wed Jan 28 19:13:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 434342 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 719FC1402B0 for ; Thu, 29 Jan 2015 14:40:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756637AbbA2DkL (ORCPT ); Wed, 28 Jan 2015 22:40:11 -0500 Received: from aserp1050.oracle.com ([141.146.126.70]:18504 "EHLO aserp1050.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754331AbbA2DkK (ORCPT ); Wed, 28 Jan 2015 22:40:10 -0500 X-Greylist: delayed 6307 seconds by postgrey-1.27 at vger.kernel.org; Wed, 28 Jan 2015 22:40:10 EST Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by aserp1050.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t0SJDgn5001821 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Jan 2015 19:13:42 GMT Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t0SJDcg1024250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Jan 2015 19:13:39 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t0SJDbLL011591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 28 Jan 2015 19:13:38 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t0SJDbYL014934; Wed, 28 Jan 2015 19:13:37 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 28 Jan 2015 11:13:36 -0800 Date: Wed, 28 Jan 2015 22:13:20 +0300 From: Dan Carpenter To: Linus Walleij , Kamlakant Patel Cc: Alexandre Courbot , linux-gpio@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] gpio: ge: fix error code in gef_gpio_probe() Message-ID: <20150128191320.GB10259@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-Source-IP: aserp1040.oracle.com [141.146.126.69] Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org If kstrdup() fails then we should return -ENOMEM but instead the current code returns success. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-gpio" 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/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c index 6ea9303..07e9b39 100644 --- a/drivers/gpio/gpio-ge.c +++ b/drivers/gpio/gpio-ge.c @@ -77,8 +77,10 @@ static int __init gef_gpio_probe(struct platform_device *pdev) /* Setup pointers to chip functions */ bgc->gc.label = kstrdup(pdev->dev.of_node->full_name, GFP_KERNEL); - if (!bgc->gc.label) + if (!bgc->gc.label) { + ret = -ENOMEM; goto err0; + } bgc->gc.base = -1; bgc->gc.ngpio = (u16)(uintptr_t)of_id->data;