From patchwork Thu Jul 30 15:24:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vimal singh X-Patchwork-Id: 30390 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id B4648B7B97 for ; Fri, 31 Jul 2009 01:27:10 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MWXV5-0006o0-8X; Thu, 30 Jul 2009 15:24:59 +0000 Received: from qw-out-1920.google.com ([74.125.92.146]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MWXUx-0006nP-Ja for linux-mtd@lists.infradead.org; Thu, 30 Jul 2009 15:24:57 +0000 Received: by qw-out-1920.google.com with SMTP id 5so1017141qwf.24 for ; Thu, 30 Jul 2009 08:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=9uLkxqfPEEJOrp70JDVUDNjK3SM3eylIydpLvFN220M=; b=ajnetPSKqcGxqkrq/kToTKn3oxojofUPu7Li/KFMMrXKkgHugWcXcvK+n6zaRgZj5M BPP6BpRja745Ln2PBWQTZ4TU6ierc8jwfZdHHHsWsldwbqsEMAl8JQ6cc6og9nUW8YY8 al8cUaZzGkLQArUOv+dHd7fF6HotZ+/SQjU9I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=PUb9MsIRFwCD9WT+MqQ+Op4I0aIk4UyfYS3LQLT+up+jtvyge/3RbcsOvtGeTGEhyZ 77rLiGtWaQOS7ImNEDGKqobnszLMDlHXqcVkHem5ymb9/2Vf+LRXQHPCZCZ8kHVAmRu9 G7sbG0tF1fIVkcoZxekme8PPhp8XTckIuvpyk= MIME-Version: 1.0 Received: by 10.229.70.138 with SMTP id d10mr231097qcj.22.1248967490485; Thu, 30 Jul 2009 08:24:50 -0700 (PDT) In-Reply-To: <4A71B940.80607@uiuc.edu> References: <1248958178-22599-1-git-send-email-sgayda2@uiuc.edu> <4A719A27.8050509@linutronix.de> <4A71A483.30507@linutronix.de> <4A71AD5E.4080704@uiuc.edu> <4A71B401.1090208@linutronix.de> <4A71B940.80607@uiuc.edu> From: vimal singh Date: Thu, 30 Jul 2009 20:54:27 +0530 Message-ID: Subject: Re: [PATCH] [mtd] fixed faulty check To: Stoyan Gaydarov X-Spam-Score: 0.0 (/) Cc: kay.sievers@vrfy.org, David.Woodhouse@intel.com, gregkh@suse.de, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, sr@denx.de X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch fixes a spelling error that has resulted from copy and pasting. The location of the error was found using a semantic patch but the semantic patch was not trying to find these errors. After looking things over it seemed logical that this change was needed. The patch also makes sure mtd_list is not being freed if it has not been allocated Signed-off-by: Stoyan Gaydarov Signed-off-by: Vimal Singh diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 39d357b..584a1c8 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -204,7 +204,7 @@ static int __devinit of_flash_probe(struct of_device *dev, dev_err(&dev->dev, "Malformed reg property on %s\n", dev->node->full_name); err = -EINVAL; - goto err_out; + goto err_flash_remove; } count /= reg_tuple_size; @@ -212,14 +212,14 @@ static int __devinit of_flash_probe(struct of_device *dev, info = kzalloc(sizeof(struct of_flash) + sizeof(struct of_flash_list) * count, GFP_KERNEL); if (!info) - goto err_out; - - mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL); - if (!info) - goto err_out; + goto err_flash_remove; dev_set_drvdata(&dev->dev, info); + mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL); + if (!mtd_list) + goto err_flash_remove; + for (i = 0; i < count; i++) { err = -ENXIO; if (of_address_to_resource(dp, i, &res)) { @@ -338,6 +338,7 @@ static int __devinit of_flash_probe(struct of_device *dev, err_out: kfree(mtd_list); +err_flash_remove: of_flash_remove(dev); return err;