Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751458AbdGRPpP (ORCPT ); Tue, 18 Jul 2017 11:45:15 -0400 Received: from mail-lf0-f54.google.com ([209.85.215.54]:35960 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751366AbdGRPpN (ORCPT ); Tue, 18 Jul 2017 11:45:13 -0400 Date: Tue, 18 Jul 2017 17:45:21 +0200 From: Johan Hovold To: Alexey Khoroshilov Cc: Greg Kroah-Hartman , Jiri Slaby , Arnd Bergmann , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH v2] serial: 8250: fix error handling in of_platform_serial_probe() Message-ID: <20170718154521.GA7132@localhost> References: <032e9a8b-8013-fe60-4a49-11cbf5cc28ed@ispras.ru> <1500377531-28358-1-git-send-email-khoroshilov@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1500377531-28358-1-git-send-email-khoroshilov@ispras.ru> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1317 Lines: 46 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 > @@ -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