Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753712Ab2KHGNs (ORCPT ); Thu, 8 Nov 2012 01:13:48 -0500 Received: from mail-qa0-f53.google.com ([209.85.216.53]:53178 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751429Ab2KHGNr (ORCPT ); Thu, 8 Nov 2012 01:13:47 -0500 MIME-Version: 1.0 In-Reply-To: <20121106165144.bdeca850.akpm@linux-foundation.org> References: <20121106165144.bdeca850.akpm@linux-foundation.org> Date: Thu, 8 Nov 2012 14:13:46 +0800 Message-ID: Subject: Re: [PATCH] rtc: avoid calling platform_device_put() twice in test_init() From: Wei Yongjun To: akpm@linux-foundation.org Cc: a.zummo@towertech.it, yongjun_wei@trendmicro.com.cn, rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1142 Lines: 32 On 11/07/2012 08:51 AM, Andrew Morton wrote: > On Tue, 23 Oct 2012 13:08:41 +0800 > Wei Yongjun wrote: > >> From: Wei Yongjun >> >> In case of error, the function test_init() need to call >> platform_device_del() instead of platform_device_unregister(). >> Otherwise, we may call platform_device_put() twice. >> > Is platform_device_del() the partner to platform_device_add()? If so > then yes, this looks right. But I think the labels can be improved: > > _ > > > However, take a look at test_exit(). it does > platform_device_unregister(test0) when test0 is in the same state. Is > that code wrong as well? Presumably it's working OK? platform_device_unregister() is a warp of platform_device_del() and platform_device_put(), if platform_device_add() success, we can use platform_device_unregister() to do this, so that code is OK. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/