linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] driver: s3c_camif: move s3c_camif_unregister_subdev out of camif_unregister_media_entities
@ 2021-10-19  3:39 Dongliang Mu
  0 siblings, 0 replies; only message in thread
From: Dongliang Mu @ 2021-10-19  3:39 UTC (permalink / raw)
  To: Sylwester Nawrocki, Mauro Carvalho Chehab
  Cc: Dongliang Mu, linux-media, linux-samsung-soc, linux-kernel

In the error handling of s3c_camif_probe, s3c_camif_unregister_subdev
may be executed twice, one is from camif_unregister_media_entities.
Although there is sanity check about the registration status,
it is not good to call s3c_camif_unregister_subdev twice in the error
handling code.

Fix this by moving s3c_camif_unregister_subdev out of
camif_unregister_media_entities, and add a s3c_camif_unregister_subdev
in the s3c_camif_remove.

Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
 drivers/media/platform/s3c-camif/camif-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c
index e1d51fd3e700..ba91cf7d3ab0 100644
--- a/drivers/media/platform/s3c-camif/camif-core.c
+++ b/drivers/media/platform/s3c-camif/camif-core.c
@@ -292,7 +292,6 @@ static void camif_unregister_media_entities(struct camif_dev *camif)
 {
 	camif_unregister_video_nodes(camif);
 	camif_unregister_sensor(camif);
-	s3c_camif_unregister_subdev(camif);
 }
 
 /*
@@ -524,6 +523,7 @@ static int s3c_camif_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 	camif_clk_put(camif);
+	s3c_camif_unregister_subdev(camif);
 	pdata->gpio_put();
 
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-19  3:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19  3:39 [PATCH] driver: s3c_camif: move s3c_camif_unregister_subdev out of camif_unregister_media_entities Dongliang Mu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).