Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755443Ab2FTM52 (ORCPT ); Wed, 20 Jun 2012 08:57:28 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:54985 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753552Ab2FTM51 convert rfc822-to-8bit (ORCPT ); Wed, 20 Jun 2012 08:57:27 -0400 MIME-Version: 1.0 In-Reply-To: <20120620080652.GA15937@ioremap.net> References: <1339949879-26085-1-git-send-email-devendra.aaru@gmail.com> <20120620080652.GA15937@ioremap.net> Date: Wed, 20 Jun 2012 18:27:26 +0530 Message-ID: Subject: Re: [PATCH] drivers/w1: free the w1_master at w1_free_dev and return a correct return value From: "devendra.aaru" To: Evgeniy Polyakov Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1641 Lines: 45 Hi Evgeniy, On Wed, Jun 20, 2012 at 1:36 PM, Evgeniy Polyakov wrote: > Hi > > On Sun, Jun 17, 2012 at 09:47:59PM +0530, Devendra Naga (devendra.aaru@gmail.com) wrote: >> the w1_master pointer is allced at the w1_alloc_master and is not freed when called with >> w1_remove_master. >> >> when w1_alloc_dev fails the return should be -ENODEV as it does >> device_register, and that is the last case where that function >> will fail. >> >> Signed-off-by: Devendra Naga > > Hmm, looks correct, but I wonder how whatever_free() function happend > not to free its arguments. > I think , it its good to have the kfree after calling the w1_free_dev as this way looks so wierd calling of kfree. > Looks like device_unregister() calls release callback, but we do not > provide one. > vim -t device_unregister points me to drivers/base/core.c device_unregister function, where we do a device_del, where we do a dev_release_all where it calls release_nodes which calls the release callback. is that what you are telling? if so actually we are passing the structure w1_master_device which is of struct device. its having a release callback. and there we free the master device. please suggest me if i mistaken.... > Greg, please pull it into your tree. Thank you. > Acked-by: Evgeniy Polyakov > > -- > ? ? ? ?Evgeniy Polyakov Thanks, Devendra. -- 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/