public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Libo Chen <clbchenlibo.chen@huawei•com>
To: <timur@tabi•org>, Greg KH <gregkh@linuxfoundation•org>
Cc: jslaby@suse•cz, linux-kernel@vger•kernel.org,
	Rob Herring <rob.herring@calxeda•com>,
	Li Zefan <lizefan@huawei•com>,
	linux-serial@vger•kernel.org,
	Grant Likely <grant.likely@linaro•org>,
	linuxppc-dev@lists•ozlabs.org
Subject: [PATCH] driver: tty: add missing unregister in err case
Date: Wed, 29 May 2013 10:33:16 +0800	[thread overview]
Message-ID: <51A568EC.2070103@huawei.com> (raw)


when platform_driver_register broken, we should unregister ucc_uart_driver

Signed-off-by: Libo chen <libo.chen@huawei•com>
---
 drivers/tty/serial/ucc_uart.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 7355303..f86f447 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1518,9 +1518,11 @@ static int __init ucc_uart_init(void)
 	}

 	ret = platform_driver_register(&ucc_uart_of_driver);
-	if (ret)
+	if (ret) {
 		printk(KERN_ERR
 		       "ucc-uart: could not register platform driver\n");
+		uart_unregister_driver(&ucc_uart_driver);
+	}

 	return ret;
 }
-- 
1.7.1

             reply	other threads:[~2013-05-29  2:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29  2:33 Libo Chen [this message]
2013-05-29  2:37 ` [PATCH] driver: tty: add missing unregister in err case Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51A568EC.2070103@huawei.com \
    --to=clbchenlibo.chen@huawei$(echo .)com \
    --cc=grant.likely@linaro$(echo .)org \
    --cc=gregkh@linuxfoundation$(echo .)org \
    --cc=jslaby@suse$(echo .)cz \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-serial@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=lizefan@huawei$(echo .)com \
    --cc=rob.herring@calxeda$(echo .)com \
    --cc=timur@tabi$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox