From patchwork Fri Aug 26 09:21:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 1101692 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7Q9NcGo006086 for ; Fri, 26 Aug 2011 09:23:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754570Ab1HZJXd (ORCPT ); Fri, 26 Aug 2011 05:23:33 -0400 Received: from mail-pz0-f42.google.com ([209.85.210.42]:44638 "EHLO mail-pz0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753553Ab1HZJXc (ORCPT ); Fri, 26 Aug 2011 05:23:32 -0400 Received: by pzk37 with SMTP id 37so3958888pzk.1 for ; Fri, 26 Aug 2011 02:23:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=+yDvvT5m368WE0snwvzPrmiBTxCKmE4EvTGFK3Dd4EU=; b=VFqrmdBjGqmSHfI0IwHbZb85NQXQ2JQQtt/notVGjNbJNqaB9U59qsVeqdx4WziNSe fhkk01eReQK1ysY2bGgdtqxlKaqRtj1JT5ejEfA+oeMPcACu/D2W5MMt/RWXUPDB/U2x FTfd92Gv6F04Mi/eW/JvtXVQHKQuYHqI2FfvQ= Received: by 10.143.97.15 with SMTP id z15mr423883wfl.405.1314350612501; Fri, 26 Aug 2011 02:23:32 -0700 (PDT) Received: from shale.localdomain ([41.139.221.94]) by mx.google.com with ESMTPS id y11sm1410654wfc.11.2011.08.26.02.23.27 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 26 Aug 2011 02:23:31 -0700 (PDT) Date: Fri, 26 Aug 2011 12:21:13 +0300 From: Dan Carpenter To: Felipe Balbi Cc: Greg Kroah-Hartman , "open list:DESIGNWARE USB3 D..." , "open list:DESIGNWARE USB3 D..." , kernel-janitors@vger.kernel.org Subject: [patch] dwc3: add a kfree() on error to dwc3_testmode_open() Message-ID: <20110826092113.GO5975@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 26 Aug 2011 09:23:38 +0000 (UTC) We may as well fix this potential leak so we don't have to listen to the static checkers complain. Signed-off-by: Dan Carpenter --- Btw. This function returns -EBUSY on success. Was that really what you want? -- To unsubscribe from this list: send the line "unsubscribe linux-omap" 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/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index 432df53..dd861c4 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -445,8 +445,10 @@ static int dwc3_testmode_open(struct inode *inode, struct file *file) if (!buf0) return -ENOMEM; buf1 = kmalloc(BUF_SIZE, GFP_KERNEL); - if (!buf1) + if (!buf1) { + kfree(buf0); return -ENOMEM; + } memset(buf0, 0xaa, BUF_SIZE); memset(buf1, 0x33, BUF_SIZE);