From patchwork Sun Jun 3 06:24:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devendra Naga X-Patchwork-Id: 162474 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-pb0-f56.google.com (mail-pb0-f56.google.com [209.85.160.56]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 4EE10B6EEC for ; Sun, 3 Jun 2012 16:24:44 +1000 (EST) Received: by pbbro12 with SMTP id ro12sf3094112pbb.11 for ; Sat, 02 Jun 2012 23:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; 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:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=bguCYrWAFSFgEzqM7i9phUdPZmBZj85G649BvRpKof4=; b=q1ILd6hOBwFN1pND7MaO6o8FD55rRZC33FHVriwIorvrNbm4Vir1BlS8WDLs+V2My1 Q6vjJjG0CgS1vmABHe0KrrkS98hfBcapkZ6YvxZsvriRWl5o7Wrb/qdBPcKiUXZzALWI hYpvLTNtjWm3WkDtFtPHt/ZJ/2gCyo9ELpyUM= Received: by 10.68.240.33 with SMTP id vx1mr180506pbc.10.1338704682997; Sat, 02 Jun 2012 23:24:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.68.131.35 with SMTP id oj3ls11190587pbb.2.gmail; Sat, 02 Jun 2012 23:24:42 -0700 (PDT) Received: by 10.68.241.7 with SMTP id we7mr7614373pbc.4.1338704682279; Sat, 02 Jun 2012 23:24:42 -0700 (PDT) Received: by 10.68.241.7 with SMTP id we7mr7614372pbc.4.1338704682268; Sat, 02 Jun 2012 23:24:42 -0700 (PDT) Received: from mail-pb0-f48.google.com (mail-pb0-f48.google.com [209.85.160.48]) by gmr-mx.google.com with ESMTPS id iq5si10311984pbc.1.2012.06.02.23.24.42 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 02 Jun 2012 23:24:42 -0700 (PDT) Received-SPF: pass (google.com: domain of devendra.aaru@gmail.com designates 209.85.160.48 as permitted sender) client-ip=209.85.160.48; Received: by pbbrq8 with SMTP id rq8so5231611pbb.7 for ; Sat, 02 Jun 2012 23:24:42 -0700 (PDT) Received: by 10.68.130.35 with SMTP id ob3mr27206458pbb.40.1338704682145; Sat, 02 Jun 2012 23:24:42 -0700 (PDT) Received: from localhost.localdomain ([122.172.42.229]) by mx.google.com with ESMTPS id iv8sm549634pbc.53.2012.06.02.23.24.37 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 02 Jun 2012 23:24:41 -0700 (PDT) From: Devendra Naga To: Alessandro Zummo , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Cc: Devendra Naga Subject: [rtc-linux] [PATCH] rtc/rtc-spear: free the config right after the rtc_device_unregister Date: Sun, 3 Jun 2012 11:54:19 +0530 Message-Id: <1338704660-30921-1-git-send-email-devendra.aaru@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Original-Sender: devendra.aaru@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of devendra.aaru@gmail.com designates 209.85.160.48 as permitted sender) smtp.mail=devendra.aaru@gmail.com; dkim=pass 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: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , the config was freed and its used again at rtc_device_unregister which leads to a kernel panic. so, do it right after the rtc_device_unregister Signed-off-by: Devendra Naga Reviewed-by: Viresh Kumar Reviewed-by: Viresh Kumar --- drivers/rtc/rtc-spear.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index 1f76320..e278547 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c @@ -458,12 +458,12 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev) clk_disable(config->clk); clk_put(config->clk); iounmap(config->ioaddr); - kfree(config); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res) release_mem_region(res->start, resource_size(res)); platform_set_drvdata(pdev, NULL); rtc_device_unregister(config->rtc); + kfree(config); return 0; }