From patchwork Sun Sep 19 12:55:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kulikov Vasiliy X-Patchwork-Id: 65157 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ww0-f56.google.com (mail-ww0-f56.google.com [74.125.82.56]) by ozlabs.org (Postfix) with ESMTP id D96F0B6ED0 for ; Sun, 19 Sep 2010 22:55:13 +1000 (EST) Received: by wwi14 with SMTP id 14sf1933627wwi.11 for ; Sun, 19 Sep 2010 05:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:mime-version:x-beenthere:received :received:received:received:received-spf:received:received:received :from:to:cc:subject:date:message-id:x-mailer:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=F0Rz+27+VMan/GYVhIb4Eayr+dZ8pvB+Rx1h4C+FREs=; b=bJ1LzPj0AaFiP8ch1g84qVfVaCh/m3fHryIZwTAaA5sYguLra6V3Jwnzg68lf1s41z 74Gs/QIQvh2lkm5lummzgj6uM5+7E8Gy5x/sSKJGdrrvQt3TejjecUH7u8HEKA1r8d0V fK/0nWNXkU/PXG///2f4NjvfrvEBtuZi2sfZk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=nAw18jyxlb9rF2X1Nazq+zkYcJl6NnzJs08NEp6wqitikSzRb9jUV27mvipvXjs/2A DxKcYxZ8QKjF2Sh1JyuEXNxANhJNeI4g9ZPjIYgj+RPQhHuiZXd7CBF1Q5aSMFRUoh1n 4+UFqAcZey1e+wnQN2N6o74S25fdndMEFvWtE= Received: by 10.216.145.130 with SMTP id p2mr1383942wej.7.1284900910043; Sun, 19 Sep 2010 05:55:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.213.43.207 with SMTP id x15ls1669252ebe.1.p; Sun, 19 Sep 2010 05:55:09 -0700 (PDT) Received: by 10.213.32.2 with SMTP id a2mr1323590ebd.11.1284900909424; Sun, 19 Sep 2010 05:55:09 -0700 (PDT) Received: by 10.213.32.2 with SMTP id a2mr1323589ebd.11.1284900909397; Sun, 19 Sep 2010 05:55:09 -0700 (PDT) Received: from mail-ew0-f46.google.com (mail-ew0-f46.google.com [209.85.215.46]) by gmr-mx.google.com with ESMTP id a48si6795557eei.2.2010.09.19.05.55.08; Sun, 19 Sep 2010 05:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of segooon@gmail.com designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by ewy23 with SMTP id 23so1372141ewy.19 for ; Sun, 19 Sep 2010 05:55:08 -0700 (PDT) Received: by 10.213.33.84 with SMTP id g20mr1781731ebd.4.1284900908257; Sun, 19 Sep 2010 05:55:08 -0700 (PDT) Received: from localhost (ppp91-78-208-175.pppoe.mtu-net.ru [91.78.208.175]) by mx.google.com with ESMTPS id v59sm9194425eeh.10.2010.09.19.05.55.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 19 Sep 2010 05:55:08 -0700 (PDT) From: Vasiliy Kulikov To: kernel-janitors@vger.kernel.org Cc: Alessandro Zummo , Andrew Morton , Tejun Heo , Aaro Koskinen , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [rtc-linux] [PATCH 09/14] rtc: fix device_register() error handling Date: Sun, 19 Sep 2010 16:55:04 +0400 Message-Id: <1284900904-24579-1-git-send-email-segooon@gmail.com> X-Mailer: git-send-email 1.7.0.4 X-Original-Sender: segooon@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of segooon@gmail.com designates 209.85.215.46 as permitted sender) smtp.mail=segooon@gmail.com; dkim=pass (test mode) header.i=@gmail.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , If device_register() fails then call put_device(). See comment to device_register. Signed-off-by: Vasiliy Kulikov --- compile tested. drivers/rtc/class.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 565562b..e6539cb 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -158,8 +158,10 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, rtc_dev_prepare(rtc); err = device_register(&rtc->dev); - if (err) + if (err) { + put_device(&rtc->dev); goto exit_kfree; + } rtc_dev_add_device(rtc); rtc_sysfs_add_device(rtc);