Re: [PATCH V2] rtc: add devm_rtc_device_{register,unregister}()

From: 'Tejun Heo'
Date: Mon Feb 25 2013 - 20:23:27 EST


Hello,

On Tue, Feb 26, 2013 at 10:21:06AM +0900, Jingoo Han wrote:
> These functios allows the driver core to automatically clean up
> any allocation made by rtc drivers. Thus, it simplifies the error
> paths.
>
> Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx>

Looks okay to me but

> +static int devm_rtc_device_match(struct device *dev, void *res, void *data)
> +{
> + struct rtc **r = res;
> + if (WARN_ON(!r || !*r))
> + return 0;
> +
> + return *r == data;
> +}

again, why do we need the WARN_ON() at all given that other
devm_*_match() don't do that and the only way to get NULL there would
be bug in devm_rtc*() code itself rather than its users?

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/