linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: Missing uart_unregister_driver() on error in sci_probe_single()
@ 2019-03-08 14:23 Mao Wenan
  2019-03-11  7:22 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Mao Wenan @ 2019-03-08 14:23 UTC (permalink / raw)
  To: gregkh, jslaby, linux-serial, kernel-janitors, linux-kernel

Add the missing uart_unregister_driver() before return
from sci_probe_single() in the error handling case.

Signed-off-by: Mao Wenan <maowenan@huawei.com>
---
 drivers/tty/serial/sh-sci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 64bbeb7d7e0c..dde4eac9d222 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3254,8 +3254,10 @@ static int sci_probe_single(struct platform_device *dev,
 	mutex_unlock(&sci_uart_registration_lock);
 
 	ret = sci_init_single(dev, sciport, index, p, false);
-	if (ret)
+	if (ret) {
+		uart_unregister_driver(&sci_uart_driver);
 		return ret;
+	}
 
 	sciport->gpios = mctrl_gpio_init(&sciport->port, 0);
 	if (IS_ERR(sciport->gpios) && PTR_ERR(sciport->gpios) != -ENOSYS)
-- 
2.20.1


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

* Re: [PATCH] serial: sh-sci: Missing uart_unregister_driver() on error in sci_probe_single()
  2019-03-08 14:23 [PATCH] serial: sh-sci: Missing uart_unregister_driver() on error in sci_probe_single() Mao Wenan
@ 2019-03-11  7:22 ` Dan Carpenter
  2019-03-11  9:33   ` maowenan
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2019-03-11  7:22 UTC (permalink / raw)
  To: Mao Wenan; +Cc: gregkh, jslaby, linux-serial, kernel-janitors, linux-kernel

On Fri, Mar 08, 2019 at 10:23:10PM +0800, Mao Wenan wrote:
> Add the missing uart_unregister_driver() before return
> from sci_probe_single() in the error handling case.
> 
> Signed-off-by: Mao Wenan <maowenan@huawei.com>
> ---
>  drivers/tty/serial/sh-sci.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 64bbeb7d7e0c..dde4eac9d222 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -3254,8 +3254,10 @@ static int sci_probe_single(struct platform_device *dev,
>  	mutex_unlock(&sci_uart_registration_lock);
>  
>  	ret = sci_init_single(dev, sciport, index, p, false);
> -	if (ret)
> +	if (ret) {
> +		uart_unregister_driver(&sci_uart_driver);
>  		return ret;

Why only this error path and not the next one?

> +	}
>  
>  	sciport->gpios = mctrl_gpio_init(&sciport->port, 0);
>  	if (IS_ERR(sciport->gpios) && PTR_ERR(sciport->gpios) != -ENOSYS)
            ^^^^^^^^^^^^^^^^^^^^^
This one.

regards,
dan carpenter


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

* Re: [PATCH] serial: sh-sci: Missing uart_unregister_driver() on error in sci_probe_single()
  2019-03-11  7:22 ` Dan Carpenter
@ 2019-03-11  9:33   ` maowenan
  0 siblings, 0 replies; 3+ messages in thread
From: maowenan @ 2019-03-11  9:33 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, jslaby, linux-serial, kernel-janitors, linux-kernel



On 2019/3/11 15:22, Dan Carpenter wrote:
> On Fri, Mar 08, 2019 at 10:23:10PM +0800, Mao Wenan wrote:
>> Add the missing uart_unregister_driver() before return
>> from sci_probe_single() in the error handling case.
>>
>> Signed-off-by: Mao Wenan <maowenan@huawei.com>
>> ---
>>  drivers/tty/serial/sh-sci.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
>> index 64bbeb7d7e0c..dde4eac9d222 100644
>> --- a/drivers/tty/serial/sh-sci.c
>> +++ b/drivers/tty/serial/sh-sci.c
>> @@ -3254,8 +3254,10 @@ static int sci_probe_single(struct platform_device *dev,
>>  	mutex_unlock(&sci_uart_registration_lock);
>>  
>>  	ret = sci_init_single(dev, sciport, index, p, false);
>> -	if (ret)
>> +	if (ret) {
>> +		uart_unregister_driver(&sci_uart_driver);
>>  		return ret;
> 
> Why only this error path and not the next one?
> 
>> +	}
>>  
>>  	sciport->gpios = mctrl_gpio_init(&sciport->port, 0);
>>  	if (IS_ERR(sciport->gpios) && PTR_ERR(sciport->gpios) != -ENOSYS)
>             ^^^^^^^^^^^^^^^^^^^^^
> This one.

yes, this one need it too. resend v2.
thank you.
> 
> regards,
> dan carpenter
> 
> 
> .
> 


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

end of thread, other threads:[~2019-03-11  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08 14:23 [PATCH] serial: sh-sci: Missing uart_unregister_driver() on error in sci_probe_single() Mao Wenan
2019-03-11  7:22 ` Dan Carpenter
2019-03-11  9:33   ` maowenan

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).