[PATCH v3] Create add_rtc() function to enable the RTC CMOS driver

Segher Boessenkool segher at kernel.crashing.org
Thu Jun 21 03:46:54 EST 2007


> +	/*
> +	 * RTC_PORT(x) is hardcoded in asm/mc146818rtc.h.  Verify that the
> +	 * address provided by the device node matches.
> +	 */
> +	if (res.start != RTC_PORT(0)) {
> +		of_node_put(np);
> +		return -ENODEV;
> +	}

You can place the of_node_put() here and remove the
previous one, and the following one.

> +	pd = platform_device_register_simple("rtc_cmos", -1,
> +					     &res, 1);
> +	of_node_put(np);

Code looks fine, with or without that change.


Segher




More information about the Linuxppc-dev mailing list