mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: vimc: Fix wrong function called when vimc_init() fails
@ 2022-11-10  7:26 Chen Zhongjin
  2022-11-10 16:56 ` Shuah Khan
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Zhongjin @ 2022-11-10  7:26 UTC (permalink / raw)
  To: linux-kernel, linux-media
  Cc: skhan, kieran.bingham, mchehab, hans.verkuil, helen.koike, chenzhongjin

In vimc_init(), when platform_driver_register(&vimc_pdrv) fails,
platform_driver_unregister(&vimc_pdrv) is wrongly called rather than
platform_device_unregister(&vimc_pdev), which causes kernel warning:

 Unexpected driver unregister!
 WARNING: CPU: 1 PID: 14517 at drivers/base/driver.c:270 driver_unregister+0x8f/0xb0
 RIP: 0010:driver_unregister+0x8f/0xb0
 Call Trace:
  <TASK>
  vimc_init+0x7d/0x1000 [vimc]
  do_one_initcall+0xd0/0x4e0
  do_init_module+0x1cf/0x6b0
  load_module+0x65c2/0x7820

Fixes: 4a29b7090749 ("[media] vimc: Subdevices as modules")
Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
---
 drivers/media/test-drivers/vimc/vimc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/test-drivers/vimc/vimc-core.c b/drivers/media/test-drivers/vimc/vimc-core.c
index 2ae7a0f11ebf..e82cfa5ffbf4 100644
--- a/drivers/media/test-drivers/vimc/vimc-core.c
+++ b/drivers/media/test-drivers/vimc/vimc-core.c
@@ -433,7 +433,7 @@ static int __init vimc_init(void)
 	if (ret) {
 		dev_err(&vimc_pdev.dev,
 			"platform driver registration failed (err=%d)\n", ret);
-		platform_driver_unregister(&vimc_pdrv);
+		platform_device_unregister(&vimc_pdev);
 		return ret;
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: vimc: Fix wrong function called when vimc_init() fails
  2022-11-10  7:26 [PATCH] media: vimc: Fix wrong function called when vimc_init() fails Chen Zhongjin
@ 2022-11-10 16:56 ` Shuah Khan
  0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2022-11-10 16:56 UTC (permalink / raw)
  To: Chen Zhongjin, linux-kernel, linux-media
  Cc: kieran.bingham, mchehab, hans.verkuil, helen.koike, Shuah Khan

On 11/10/22 00:26, Chen Zhongjin wrote:
> In vimc_init(), when platform_driver_register(&vimc_pdrv) fails,
> platform_driver_unregister(&vimc_pdrv) is wrongly called rather than
> platform_device_unregister(&vimc_pdev), which causes kernel warning:
> 
>   Unexpected driver unregister!
>   WARNING: CPU: 1 PID: 14517 at drivers/base/driver.c:270 driver_unregister+0x8f/0xb0
>   RIP: 0010:driver_unregister+0x8f/0xb0
>   Call Trace:
>    <TASK>
>    vimc_init+0x7d/0x1000 [vimc]
>    do_one_initcall+0xd0/0x4e0
>    do_init_module+0x1cf/0x6b0
>    load_module+0x65c2/0x7820
> 
> Fixes: 4a29b7090749 ("[media] vimc: Subdevices as modules")
> Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
> ---
>   drivers/media/test-drivers/vimc/vimc-core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/test-drivers/vimc/vimc-core.c b/drivers/media/test-drivers/vimc/vimc-core.c
> index 2ae7a0f11ebf..e82cfa5ffbf4 100644
> --- a/drivers/media/test-drivers/vimc/vimc-core.c
> +++ b/drivers/media/test-drivers/vimc/vimc-core.c
> @@ -433,7 +433,7 @@ static int __init vimc_init(void)
>   	if (ret) {
>   		dev_err(&vimc_pdev.dev,
>   			"platform driver registration failed (err=%d)\n", ret);
> -		platform_driver_unregister(&vimc_pdrv);
> +		platform_device_unregister(&vimc_pdev);
>   		return ret;
>   	}
>   

Good catch. Thanks for fixing it. Now applied for next rc.

https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git/?h=vimc

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-10 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  7:26 [PATCH] media: vimc: Fix wrong function called when vimc_init() fails Chen Zhongjin
2022-11-10 16:56 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®