Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13333834ybl; Sun, 29 Dec 2019 09:31:22 -0800 (PST) X-Google-Smtp-Source: APXvYqz2rZyH1sbatatFbanHWdxUv3lj4BqP12zDeOK+k6ocQM3l3GVgVb8Ivezcb9CnmsV48AwL X-Received: by 2002:a05:6830:2110:: with SMTP id i16mr67782355otc.337.1577640682309; Sun, 29 Dec 2019 09:31:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640682; cv=none; d=google.com; s=arc-20160816; b=tgE8ZHNft+TWv4GGVOwd96YIO7B2m8FDUksb717bfp+gT/w+DC0Dm2c2leI/XaIT+S XAj1lbpeEDNizxt1gerlAgwdsHXbmX+xo1EGiWYM60aC/hchCbT8j7fGbBaKMWV3sUKp B5W1UNc3VQucrb+pYThB954HbcLNj9xGBx+tvybuvNPtwpYd/lB3bDzfDVqDM0PKndTu mWpdyyM0btG/6k9Y6ODRSnb8TtzGiGnBJdodItfmXV6Sb+Hqg9HPuHlTmAhRB3M0XpPs n71acnfb2lsQYtc/MXELv6aoT5Or6oTnotIG2aZ2zSbLxnb+sQghTfJl6U5wouPI+fMz Z15A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nmjp97APYJDP6JAambqsM+Jjzyc2Kiuf7KDiymy7dQc=; b=fRMt05L+B7l4f+DFNtIR1CVGcWP0+6Tw4D1qr0Y/Luc2+7LLKaJ/5prIu1pqXxkPOW PD0xHdDl+zOj7EgKSUNY5o8GCGBk+2I/k5UwL8sWgtih8IlDChQ0BoDoN56BFwP1K0Kx qyDbHD5TFbE1FmrHLNSINXSQP/7w2IVN2AUcMSA2WRFdQFz5I9Wa+UEimSW7FK5fSaKB WCjaw+SPZEQv6Y1Clh6pVaAJtV5CdLz/4Y8qQf05a3BgB81nU6Qg1qacm9XH4PqjkXOD jjkMO46KrayEK7GWd9/Bm2xwmJQdqvLpVprj6kXUq18WcTEOeDJKd2JRTAVyvpMOCR9P v9dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="2RjiKl/9"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si19484632otn.7.2019.12.29.09.31.10; Sun, 29 Dec 2019 09:31:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="2RjiKl/9"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728909AbfL2RaE (ORCPT + 99 others); Sun, 29 Dec 2019 12:30:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:55430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728841AbfL2RaB (ORCPT ); Sun, 29 Dec 2019 12:30:01 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 83B8920409; Sun, 29 Dec 2019 17:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640601; bh=UTz8xAFQTx41k8diGA/HtQkDJBcUFQ9otGZxlUVZmbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2RjiKl/9uJEq9v+s0js1ezycm74rEFrsMcBGVFjYcBI8ItTmJTVAxp3LT0jtUnyKC 42GLcclPgJYxIiVWNp6QjzsUXCryHeEhfBt8sbMLMYeLNZqoAcLBPXtQouVhNiwVAJ M0fIMGv5dijRe53z9XuKFb2+xp9drsvGJnVtyrrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 063/219] media: cx88: Fix some error handling path in cx8800_initdev() Date: Sun, 29 Dec 2019 18:17:45 +0100 Message-Id: <20191229162516.158448363@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit e1444e9b0424c70def6352580762d660af50e03f ] A call to 'pci_disable_device()' is missing in the error handling path. In some cases, a call to 'free_irq()' may also be missing. Reorder the error handling path, add some new labels and fix the 2 issues mentionned above. This way, the error handling path in more in line with 'cx8800_finidev()' (i.e. the remove function) Signed-off-by: Christophe JAILLET Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/cx88/cx88-video.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 7b113bad70d2..248fb3b6833c 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -1312,7 +1312,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, core = cx88_core_get(dev->pci); if (!core) { err = -EINVAL; - goto fail_free; + goto fail_disable; } dev->core = core; @@ -1358,7 +1358,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, cc->step, cc->default_value); if (!vc) { err = core->audio_hdl.error; - goto fail_core; + goto fail_irq; } vc->priv = (void *)cc; } @@ -1372,7 +1372,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, cc->step, cc->default_value); if (!vc) { err = core->video_hdl.error; - goto fail_core; + goto fail_irq; } vc->priv = (void *)cc; if (vc->id == V4L2_CID_CHROMA_AGC) @@ -1535,11 +1535,14 @@ static int cx8800_initdev(struct pci_dev *pci_dev, fail_unreg: cx8800_unregister_video(dev); - free_irq(pci_dev->irq, dev); mutex_unlock(&core->lock); +fail_irq: + free_irq(pci_dev->irq, dev); fail_core: core->v4ldev = NULL; cx88_core_put(core, dev->pci); +fail_disable: + pci_disable_device(pci_dev); fail_free: kfree(dev); return err; -- 2.20.1