Re: [PATCH AUTOSEL 5.10 21/38] accessiblity: speakup: Add missing misc_deregister in softsynth_probe

From: Pavel Machek
Date: Wed Jun 08 2022 - 17:08:39 EST


Hi!

> From: Zheng Bin <zhengbin13@xxxxxxxxxx>
>
> [ Upstream commit 106101303eda8f93c65158e5d72b2cc6088ed034 ]
>
> softsynth_probe misses a call misc_deregister() in an error path, this
> patch fixes that.

This seems incorrect. Registration failed, we can't really deregister.

I checked random other caller of misc_register(), and it does not seem
this API is unusual.

Best regards,
Pavel

> +++ b/drivers/accessibility/speakup/speakup_soft.c
> @@ -390,6 +390,7 @@ static int softsynth_probe(struct spk_synth *synth)
> synthu_device.name = "softsynthu";
> synthu_device.fops = &softsynthu_fops;
> if (misc_register(&synthu_device)) {
> + misc_deregister(&synth_device);
> pr_warn("Couldn't initialize miscdevice /dev/softsynthu.\n");
> return -ENODEV;
> }


--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature