From patchwork Thu Apr 14 16:31:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 8839501 Return-Path: X-Original-To: patchwork-linux-media@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 CB8509F54F for ; Thu, 14 Apr 2016 16:31:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D7272027D for ; Thu, 14 Apr 2016 16:31:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB60A202EB for ; Thu, 14 Apr 2016 16:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754734AbcDNQbZ (ORCPT ); Thu, 14 Apr 2016 12:31:25 -0400 Received: from mailout.easymail.ca ([64.68.201.169]:47361 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754394AbcDNQbY (ORCPT ); Thu, 14 Apr 2016 12:31:24 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 09E19F52A; Thu, 14 Apr 2016 12:31:23 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at mailout.easymail.ca X-Spam-Score: -3.695 X-Spam-Level: X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (easymail-mailout.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EFnMGewJIiK1; Thu, 14 Apr 2016 12:31:22 -0400 (EDT) Received: from mail.gonehiking.org (c-73-181-52-62.hsd1.co.comcast.net [73.181.52.62]) by mailout.easymail.ca (Postfix) with ESMTPA id 58EF1F4A8; Thu, 14 Apr 2016 12:31:22 -0400 (EDT) Received: from shuah-XPS-13-9350.sisa.samsung.com (shuah-xps.internal [192.168.1.87]) by mail.gonehiking.org (Postfix) with ESMTP id B12819F3E9; Thu, 14 Apr 2016 10:31:21 -0600 (MDT) From: Shuah Khan To: mchehab@osg.samsung.com, nenggun.kim@samsung.com, akpm@linux-foundation.org, jh1009.sung@samsung.com, inki.dae@samsung.com, arnd@arndb.de Cc: Shuah Khan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: saa7134 fix media_dev alloc error path to not free when alloc fails Date: Thu, 14 Apr 2016 10:31:20 -0600 Message-Id: <1460651480-6935-1-git-send-email-shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.5.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP media_dev alloc error path does kfree when alloc fails. Fix it to not call kfree when media_dev alloc fails. Signed-off-by: Shuah Khan --- drivers/media/pci/saa7134/saa7134-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index c0e1780..eab2684 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -1046,7 +1046,7 @@ static int saa7134_initdev(struct pci_dev *pci_dev, dev->media_dev = kzalloc(sizeof(*dev->media_dev), GFP_KERNEL); if (!dev->media_dev) { err = -ENOMEM; - goto fail0; + goto media_dev_alloc_fail; } media_device_pci_init(dev->media_dev, pci_dev, dev->name); dev->v4l2_dev.mdev = dev->media_dev; @@ -1309,6 +1309,7 @@ static int saa7134_initdev(struct pci_dev *pci_dev, fail0: #ifdef CONFIG_MEDIA_CONTROLLER kfree(dev->media_dev); + media_dev_alloc_fail: #endif kfree(dev); return err;