From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: ACER: Add support for accelerometer sensor Date: Wed, 27 Jun 2012 17:19:32 +0300 Message-ID: <20120627141932.GG3007@mwanda> References: <20120627131534.GA31703@elgon.mountain> <201206271532.12841.marex@denx.de> <20120627134326.GF3007@mwanda> <201206271559.16667.marex@denx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from rcsinet15.oracle.com ([148.87.113.117]:27299 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753546Ab2F0OTn (ORCPT ); Wed, 27 Jun 2012 10:19:43 -0400 Content-Disposition: inline In-Reply-To: <201206271559.16667.marex@denx.de> Sender: platform-driver-x86-owner@vger.kernel.org List-ID: To: Marek Vasut Cc: platform-driver-x86@vger.kernel.org On Wed, Jun 27, 2012 at 03:59:16PM +0200, Marek Vasut wrote: > Dear Dan Carpenter, > > > On Wed, Jun 27, 2012 at 03:32:12PM +0200, Marek Vasut wrote: > > > Dear Dan Carpenter, > > > > > > > Hello Marek Vasut, > > > > > > > > The patch 6ae3a0876185: "ACER: Add support for accelerometer sensor" > > > > from Jun 1, 2012, leads to the following Smatch warning: > > > > drivers/platform/x86/acer-wmi.c:1886 acer_wmi_accel_destroy() > > > > > > > > error: don't call input_free_device() after input_unregister_device() > > > > > > > > drivers/platform/x86/acer-wmi.c > > > > > > > > 1883 static void acer_wmi_accel_destroy(void) > > > > 1884 { > > > > 1885 input_unregister_device(acer_wmi_accel_dev); > > > > 1886 input_free_device(acer_wmi_accel_dev); > > > > 1887 } > > > > > > > > It is a double free. > > > > > > I see, understood ... shall I submit subsequent patch? > > > > Yes, please. Could you give me a: > > > > Reported-by: Dan Carpenter > > Looking through input_unregister_device(), that call doesn't free the structure. > Actually, many drivers call explicitly kfree() on it. > > Where do you see the double_free() ? > It's been a while since I looked at this code... This is described in the comments for input_unregister_device(). It's a refcounted thing. It is freed when the last reference is dropped. regards, dan carpenter