Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7076511ybi; Thu, 13 Jun 2019 09:10:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0pilrESBJQ/HuXGuE0RCJ+f9LBvq6kbHi14PfiPnbUZ+vcBFujuoe8zQzoRGF3fZ2/9co X-Received: by 2002:a17:902:2926:: with SMTP id g35mr43066797plb.269.1560442217771; Thu, 13 Jun 2019 09:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560442217; cv=none; d=google.com; s=arc-20160816; b=KuAXYWhyfJ3Aeq+xQ//Lnw5mYHsjaBjCK2gm1VuVS9r/Zibwx8ltpLIEy58GGkdpeg PKou8gxQhqCFMW5LXkionN4KDooP8faocxxUWY2Fk2GRX9d7F8lPIOVE2x2qbM57IdSb pmc1kGdAlQPMJnz9tiIZFpVbTcntoggWGGjZtcqR1q6EflImwBIPGwOrtpi7Q1NtCBB1 tE5SEbSeY0Qy7t8aTIH3dY0FSi1DNGQtIn4RpdyKCfZ6/QD9jFP1ZFPvb0euClp3m+Qu hnCE7ub8hHOJlPSs9a35J32tuxOO9A105mWp3I6ig06RIuCDFh7syx8sfLIOp4F4prNy oz4g== 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=+jO+QlsoBuh8/ttZa3FQlaQFxw9UOvDqAPQzJ0XqdTA=; b=szUR6F4uDI0CCJ2svHWhM5aQER7G6XrxZLE+Jnq3W5wU5YMqv4YxYmY2Bchd6uQQLg Z/F5SfMp9Wq2DtOK6osKXuhZIBZzZzbmU5GWetx5lwdUjZs4ZyU4wNUYP690L/LwlbgN jhazX73L3lI0+8MTJ+pLMadbVNjNLWzPprOL0RC8z0gHTuTyq4nMkPdu2AyUykXNuvj4 S7hsk5eM8BpTxAPdWjCVcKvmGaOT8ZEC/HiqnoJ2XTh28Ovp6uDrF89hL2ll9EhGreXm 91cgGfmW3xu65HYTQ979vQ12ehJw3tpRBZi6yx8y2Ubb4diT3aeIgGJTQvpZaP85wa+e SdEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Epin70MV; 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 m15si76332pjv.58.2019.06.13.09.10.02; Thu, 13 Jun 2019 09:10:17 -0700 (PDT) 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=Epin70MV; 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 S1731613AbfFMQJp (ORCPT + 99 others); Thu, 13 Jun 2019 12:09:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:33266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731260AbfFMIoV (ORCPT ); Thu, 13 Jun 2019 04:44:21 -0400 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 5FB8620851; Thu, 13 Jun 2019 08:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560415460; bh=nlxQQu1TVOMaBROokJCURPMsg/tlJX3WGEfpYjys6DU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Epin70MVnd/hXC3XexAbSCutELvPUwTjs/x4J1xlTIualSKX1qUZjAegrocQy/FxQ ksdJBzE8w3G7jOveTWvMAS9SgXniUVXnAvpJUn0jdkch5efnPetKwAU7b3/bJu4TrY +LAxC5BJ1jIM6qVNwDutcxZAG3vltT0n6IUXpzBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonas Karlman , Boris Brezillon , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.1 002/155] media: rockchip/vpu: Fix/re-order probe-error/remove path Date: Thu, 13 Jun 2019 10:31:54 +0200 Message-Id: <20190613075652.837733651@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190613075652.691765927@linuxfoundation.org> References: <20190613075652.691765927@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 [ Upstream commit fc8670d1f72b746ff3a5fe441f1fca4c4dba0e6f ] media_device_cleanup() and v4l2_m2m_unregister_media_controller() were missing in the probe error path. While at it, re-order calls in the remove path to unregister/cleanup things in the reverse order they were initialized/registered. Signed-off-by: Jonas Karlman Signed-off-by: Boris Brezillon Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c b/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c index 962412c79b91..33b556b3f0df 100644 --- a/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c +++ b/drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c @@ -481,10 +481,12 @@ static int rockchip_vpu_probe(struct platform_device *pdev) return 0; err_video_dev_unreg: if (vpu->vfd_enc) { + v4l2_m2m_unregister_media_controller(vpu->m2m_dev); video_unregister_device(vpu->vfd_enc); video_device_release(vpu->vfd_enc); } err_m2m_rel: + media_device_cleanup(&vpu->mdev); v4l2_m2m_release(vpu->m2m_dev); err_v4l2_unreg: v4l2_device_unregister(&vpu->v4l2_dev); @@ -501,13 +503,13 @@ static int rockchip_vpu_remove(struct platform_device *pdev) v4l2_info(&vpu->v4l2_dev, "Removing %s\n", pdev->name); media_device_unregister(&vpu->mdev); - v4l2_m2m_unregister_media_controller(vpu->m2m_dev); - v4l2_m2m_release(vpu->m2m_dev); - media_device_cleanup(&vpu->mdev); if (vpu->vfd_enc) { + v4l2_m2m_unregister_media_controller(vpu->m2m_dev); video_unregister_device(vpu->vfd_enc); video_device_release(vpu->vfd_enc); } + media_device_cleanup(&vpu->mdev); + v4l2_m2m_release(vpu->m2m_dev); v4l2_device_unregister(&vpu->v4l2_dev); clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks); pm_runtime_disable(vpu->dev); -- 2.20.1