From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751880AbdAZMmA (ORCPT ); Thu, 26 Jan 2017 07:42:00 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:34916 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750856AbdAZMl7 (ORCPT ); Thu, 26 Jan 2017 07:41:59 -0500 Date: Thu, 26 Jan 2017 15:41:57 +0300 From: Serge Semin To: Wei Yongjun Cc: Greg Kroah-Hartman , Wei Yongjun , linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] eeprom: idt_89hpesx: Drop kfree for memory allocated with devm_kzalloc Message-ID: <20170126124157.GB7785@mobilestation> References: <20170125140952.25764-1-weiyj.lk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170125140952.25764-1-weiyj.lk@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 25, 2017 at 02:09:52PM +0000, Wei Yongjun wrote: > From: Wei Yongjun > > It's not necessary to free memory allocated with devm_kzalloc > and using kfree leads to a double free. > > Fixes: cfad6425382e ("eeprom: Add IDT 89HPESx EEPROM/CSR driver") > Signed-off-by: Wei Yongjun > --- > drivers/misc/eeprom/idt_89hpesx.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89hpesx.c > index 25d47d0..f5f2c5a 100644 > --- a/drivers/misc/eeprom/idt_89hpesx.c > +++ b/drivers/misc/eeprom/idt_89hpesx.c > @@ -1359,7 +1359,6 @@ static int idt_create_sysfs_files(struct idt_89hpesx_dev *pdev) > pdev->ee_file->size = pdev->eesize; > ret = sysfs_create_bin_file(&dev->kobj, pdev->ee_file); > if (ret != 0) { > - kfree(pdev->ee_file); > dev_err(dev, "Failed to create EEPROM sysfs-node"); > return ret; > } > @@ -1381,9 +1380,6 @@ static void idt_remove_sysfs_files(struct idt_89hpesx_dev *pdev) > > /* Remove EEPROM sysfs file */ > sysfs_remove_bin_file(&dev->kobj, pdev->ee_file); > - > - /* Free memory allocated for bin_attribute structure */ > - kfree(pdev->ee_file); > } > > /* > True point! Thanks for the patch. Acked-by: Serge Semin