Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp459054pxj; Wed, 16 Jun 2021 06:28:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmFuecCndmecTq+qBYoDexiOrkWJKU8IxWaPf8S7rTX03Ytgxe2+8zok1F/TeOZddoOjsl X-Received: by 2002:a05:6402:31ba:: with SMTP id dj26mr4137454edb.71.1623850080915; Wed, 16 Jun 2021 06:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623850080; cv=none; d=google.com; s=arc-20160816; b=oJVEFd1gseRv3TmbyqUm6owxEpDES7LscK8T6ETQ8mG4VSfx+eMw3LzPomP8j5rWPl SIN0apuAO6h7/g7N/DHxnlmaDGZEwYFNvTHfNLRNdz0eAeL786R8edcIpXSEQonOgBCQ 8jglZlBkjxWp6F+fwQKqotpSijuae/OIQpnr5McIpvfsP/ETBgHQKi23uoYTTioZAF5X Ei8mPIDXShV+56Iu1qn3sDSdfQDLG86/otUTsVdiJCx9WkU1SMdQRg+q6vBPQV7OZ0ty sL3UPHFkcm2g36R703/zZFM0cIuedoaXWS7DKdPUcuC3mDqnbM1u8a54Ac65tUHmuJey tfhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=uIisoe76c8xAZdvhwGNwOXFV8SZsot79DAsipj0Ngk0=; b=HybdBVzIb6mZsRO3Ub1UKRzyyZguxnXMFL32iWh8GOcwJNZmSfZU+416ty6LX3qMe5 BE0XBvWRE487PPQ3h9D8dhewHSQfJdOk0bpGXjikRtAzGtpww9awn8/RcJ7kqgV3uS6b Ch0kLVuPPGouJWwv1jVhww7gyKWSgSKvnODRK5uMHJbSq8CvBxXppUVAgVOtg/e5Rgzd SAe+oo9ILYt/ApJLSDVAtsiOKX4ozwp+VlXzX6Q0aD72YzcTiYXveWOB4zr+HgVZZoqd kU43AjVAYaJ+I9Rnv9N2cL7mLBov3U9IXYQWh0wVNNbssetXDRdONbGmz9ahQ33M4OER DdGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=gJFUbmbE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ho40si2301145ejc.97.2021.06.16.06.27.38; Wed, 16 Jun 2021 06:28:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=gJFUbmbE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232984AbhFPMa6 (ORCPT + 99 others); Wed, 16 Jun 2021 08:30:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:49254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232217AbhFPMaq (ORCPT ); Wed, 16 Jun 2021 08:30:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8F9EC613BD; Wed, 16 Jun 2021 12:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623846520; bh=IZjqD2I+8Bdj62sCZmrApsPeQG82LsZGKTUJEvkz6E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJFUbmbEzqThmvQJg+a64/ryAPKBUgu6E+Q5YMtaygXjDp4wsYJWpZoM9Kxh+cXoZ w18vX5dcTxGdUFk39EgEzAI85i9rBMiJxX3KUtrZ+OXuZbuJzSzoww7rH0NKC3y25E zZpXHSWIU/MAWLpOeuyyb8r2/0bCdpwgL/nsLELVAydYh0eu7htjrfNufuGWFKzsjR 4JrdhqYAz/sI+oi2yG+IHYppk2QxVra1tfREYUHkfl2PnczYPxknBhWPL4xcw8KrW4 CEzmvmMsgXP/jyoo1IGLcnAH8yhWovwPFGx7jkklVMddn6t9De36neIfCxlL6gjbHM I6EzKdf94Pa2Q== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1ltUes-004oij-CV; Wed, 16 Jun 2021 14:28:38 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Hans Verkuil , Julia Lawall , Mauro Carvalho Chehab , Tasos Sahanidis , Vaibhav Gupta , Yang Yingliang , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 06/11] media: saa7134: fix saa7134_initdev error handling logic Date: Wed, 16 Jun 2021 14:28:32 +0200 Message-Id: <9e1b48aeaf261e37aa99d868c44acfe7df0d7fc4.1623846327.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Smatch reported an issue there: drivers/media/pci/saa7134/saa7134-core.c:1302 saa7134_initdev() warn: '&dev->devlist' not removed from list But besides freeing the list, the media controller graph also needs to be cleaned up on errors. Address those issues. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/saa7134/saa7134-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 97b1767f1fff..47158ab3956b 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -1277,14 +1277,17 @@ static int saa7134_initdev(struct pci_dev *pci_dev, */ #ifdef CONFIG_MEDIA_CONTROLLER err = media_device_register(dev->media_dev); - if (err) + if (err) { + media_device_cleanup(dev->media_dev); goto err_unregister_video; + } #endif return 0; err_unregister_video: saa7134_unregister_video(dev); + list_del(&dev->devlist); saa7134_i2c_unregister(dev); free_irq(pci_dev->irq, dev); err_iounmap: -- 2.31.1