Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13328398ybl; Sun, 29 Dec 2019 09:24:37 -0800 (PST) X-Google-Smtp-Source: APXvYqw+Ya4SBSElfK4L/UVLDHwE2twEQZ8II3lZX+kMLwJ8mxrnMzMx0oCbGR4ZOaN/juuPJhfn X-Received: by 2002:a05:6830:16d1:: with SMTP id l17mr48224147otr.21.1577640277424; Sun, 29 Dec 2019 09:24:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577640277; cv=none; d=google.com; s=arc-20160816; b=iL8E5hYOTZ5T30ZguVDobb7mKSuZ6aEHQOYK88LSHHHncfzOQ6wSNEvXgZeXo6LbNY mUb2lWeAg+D55HjZE6NACMqoHYDwWyBS+KhkZ6TgUGnFLMokMM/i6R5/1lpz4gyFahCR Lh8MnGjkDl5UD6BUBRbbf8RGJ7kTuPYQ7j/A8hRW7djEcnQ6ghWdcgzxki6MZfZ2dscg j8yxK6+4e25ndgqFy3hX3C54BeccMHygYwrdJPNTfKiWrCK+PxdBUy/3/FtsNTTW6FJ7 SIM5w7Q4YT+eR6yRZiIMEzBniqAZ44DqikJJ1Z+ghr38p7yW3D4qwolGlV5t+1XtookY R1kA== 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=mabHlL1Lf3U6sBrsiA+ZrV+KGBbnk//+dLQdQ+AwqKM=; b=CY39u3QtytCpk6Rvj3UsXuE8bH/p/MeyZSd53Kx1n7W+HsFbuIHRJzeRt98BuR6FlG mvb3UGxlqvib2lqAp0mJP+mbHTb6Nd8Lwiq7kHLJqEok+RnIjNTDyKKulLiOY13om831 XtfE1aeAJfvPGXUs8Ys4B2Cx8oYJpArvDryz9dxs7ae937/B/heAK980tzSF4Yz3AJaG H9zq7fFWoxnNDZ196/1Q3VgUo/8GobdF/xLOrqE2D3Uw8MTSsKdVr6qyXNQEn3+9TKw6 xTcQrEZD+Sy8bltnMOsT3Qw5qh6ZOcxcMTtACGGZpDXzwEqPcL5lTwOw+MNHMjXSJZDa 22yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RT1QXYw4; 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 r4si157060otq.188.2019.12.29.09.24.26; Sun, 29 Dec 2019 09:24:37 -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=RT1QXYw4; 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 S1727452AbfL2RW4 (ORCPT + 99 others); Sun, 29 Dec 2019 12:22:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:39810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727002AbfL2RWx (ORCPT ); Sun, 29 Dec 2019 12:22:53 -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 88B4620CC7; Sun, 29 Dec 2019 17:22:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640173; bh=xi2FPHfQ1DwUJkkDXeIFqp5zIvdo5B1XzYZZ0VLlqUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RT1QXYw4Jh4oavRD1AifI8v7aFa/6Y8i6sFV8QQmlx3lBubLNWUT1wCDRGYpn/qU7 EOyzVF6SrTibldy8AYSv0LN13HDIExlZDhowfKbmBT40SlckyR6muxVEP+Zlc3zBa3 4YtQ5dEZaHXIVt2GHuYCMh/43cOBBNyke0Nm7+QA= 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.14 049/161] media: cx88: Fix some error handling path in cx8800_initdev() Date: Sun, 29 Dec 2019 18:18:17 +0100 Message-Id: <20191229162413.598625208@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@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 7d25ecd4404b..1748812bd7e5 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -1310,7 +1310,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; @@ -1356,7 +1356,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; } @@ -1370,7 +1370,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) @@ -1533,11 +1533,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