public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@tilera.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <rtc-linux@googlegroups.com>, <linux-kernel@vger.kernel.org>,
	Alessandro Zummo <a.zummo@towertech.it>
Subject: Re: [rtc-linux] [PATCH] tile: add an RTC driver for the Tilera hypervisor
Date: Thu, 12 May 2011 14:33:22 -0400	[thread overview]
Message-ID: <4DCC27F2.5030206@tilera.com> (raw)
In-Reply-To: <20110511154407.ed3c0480.akpm@linux-foundation.org>

On 5/11/2011 6:44 PM, Andrew Morton wrote:
> On Wed, 4 May 2011 15:52:21 -0400
> Chris Metcalf <cmetcalf@tilera.com> wrote:
>> This is a simple RTC driver that lets Tilera hardware boot up and
>> set the clock correctly.
>>
>> ...
>>
>> +static int __init tile_rtc_driver_init(void)
>> +{
>> +	int err;
>> +
>> +	err = platform_driver_register(&tile_rtc_platform_driver);
>> +	if (err)
>> +		return err;
>> +
>> +	tile_rtc_platform_device = platform_device_alloc("rtc-tile", 0);
>> +	if (tile_rtc_platform_device == NULL) {
>> +		platform_driver_unregister(&tile_rtc_platform_driver);
>> +		return -ENOMEM;
>> +	}
>> +
>> +	err = platform_device_add(tile_rtc_platform_device);
>> +	if (err) {
>> +		platform_device_put(tile_rtc_platform_device);
> should we have a platform_driver_unregister() here?

Thanks, good catch.  I restructured this to look more like the rtc-test.c
initializer:

static int __init tile_rtc_driver_init(void)
{
	int err;

	err = platform_driver_register(&tile_rtc_platform_driver);
	if (err)
		return err;

	tile_rtc_platform_device = platform_device_alloc("rtc-tile", 0);
	if (tile_rtc_platform_device == NULL) {
		err = -ENOMEM;
		goto exit_driver_unregister;
	}

	err = platform_device_add(tile_rtc_platform_device);
	if (err)
		goto exit_device_put;

	return 0;

exit_device_put:
	platform_device_put(tile_rtc_platform_device);

exit_driver_unregister:
	platform_driver_unregister(&tile_rtc_platform_driver);
	return err;
}


-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com



      reply	other threads:[~2011-05-12 18:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 19:52 [PATCH] tile: add an RTC driver for the Tilera hypervisor Chris Metcalf
2011-05-11 22:44 ` [rtc-linux] " Andrew Morton
2011-05-12 18:33   ` Chris Metcalf [this message]

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=4DCC27F2.5030206@tilera.com \
    --to=cmetcalf@tilera.com \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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