Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1690381

Re: [PATCH v2] serial: 8250: fix error handling in of_platform_serial_probe()

From Johan Hovold <johan@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] serial: 8250: fix error handling in of_platform_serial_probe()
Date 2017-07-18 17:50 +0200
Message-ID <u4CV4-4cY-23@gated-at.bofh.it> (permalink)
References <u4vgS-7Vc-9@gated-at.bofh.it> <u4z17-1Qn-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 18, 2017 at 02:32:11PM +0300, Alexey Khoroshilov wrote:
> clk_disable_unprepare(info->clk) is missed in of_platform_serial_probe(),
> while irq_dispose_mapping(port->irq) is missed in of_platform_serial_setup().
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

> @@ -167,7 +167,9 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
>  		port->handle_irq = fsl8250_handle_irq;
>  
>  	return 0;
> -out:
> +err_dispose:
> +	irq_dispose_mapping(port->irq);
> +err_unprepare:
>  	if (info->clk)
>  		clk_disable_unprepare(info->clk);
>  	return ret;

> @@ -217,15 +219,18 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
>  
>  	ret = serial8250_register_8250_port(&port8250);
>  	if (ret < 0)
> -		goto out;
> +		goto err_register;
>  
>  	info->type = port_type;
>  	info->line = ret;
>  	platform_set_drvdata(ofdev, info);
>  	return 0;
> -out:
> -	kfree(info);
> +err_register:
>  	irq_dispose_mapping(port8250.port.irq);
> +	if (info->clk)
> +		clk_disable_unprepare(info->clk);
> +err_setup:
> +	kfree(info);

Please name also these error labels after what they do rather than after
from where you jump to them (i.e. as you did above in
of_platform_serial_setup()).

Thanks,
Johan

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] serial: 8250: fix error handling in  of_platform_serial_probe() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-07-18 09:30 +0200
  Re: [PATCH] serial: 8250: fix error handling in  of_platform_serial_probe() Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-07-18 09:40 +0200
    [PATCH v2] serial: 8250: fix error handling in of_platform_serial_probe() Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-07-18 13:40 +0200
      Re: [PATCH v2] serial: 8250: fix error handling in of_platform_serial_probe() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-18 17:10 +0200
      Re: [PATCH v2] serial: 8250: fix error handling in  of_platform_serial_probe() Johan Hovold <johan@kernel.org> - 2017-07-18 17:50 +0200
        Re: [PATCH v2] serial: 8250: fix error handling in of_platform_serial_probe() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-18 18:00 +0200
        [PATCH v3] serial: 8250: fix error handling in of_platform_serial_probe() Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-07-19 10:40 +0200

csiph-web