From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753620AbdEQJKg (ORCPT ); Wed, 17 May 2017 05:10:36 -0400 Received: from mga06.intel.com ([134.134.136.31]:51816 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751761AbdEQJKc (ORCPT ); Wed, 17 May 2017 05:10:32 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,353,1491289200"; d="scan'208";a="969356611" Date: Wed, 17 May 2017 12:10:28 +0300 From: Mika Westerberg To: Andrey Smirnov Cc: Srinivas Kandagatla , linux-kernel Subject: Re: [PATCH] nvmem: core: Prevent memory leak when device is unregistered Message-ID: <20170517091028.GB11602@lahna.fi.intel.com> References: <20170515111323.10640-1-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 16, 2017 at 02:33:55PM -0700, Andrey Smirnov wrote: > On Mon, May 15, 2017 at 4:13 AM, Mika Westerberg > wrote: > > The nvmem_unregister() calls device_del() for the device but forgets to > > call put_device() to actually release the device object which causes > > that memory to be leaked. > > > > Fix this by calling device_unregister() for the device intead which also > > calls put_device() for the device releasing it eventually. > > > > Signed-off-by: Mika Westerberg > > --- > > FWIW, I submitted similar fix for this here: > > lkml.kernel.org/r/20170418142454.23921-2-andrew.smirnov@gmail.com Cool, let's go with that one instead then :)