From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D8A888EB for ; Tue, 4 Aug 2015 14:01:46 +0000 (UTC) Received: from mail-ob0-f179.google.com (mail-ob0-f179.google.com [209.85.214.179]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 134091C4 for ; Tue, 4 Aug 2015 14:01:37 +0000 (UTC) Received: by obre1 with SMTP id e1so7660267obr.1 for ; Tue, 04 Aug 2015 07:01:37 -0700 (PDT) MIME-Version: 1.0 Sender: geert.uytterhoeven@gmail.com In-Reply-To: <20150804125556.GA5180@mwanda> References: <2111196.TG1k3f53YQ@avalon> <20150731165346.GA18984@infradead.org> <1624703.qdGzscHWSc@avalon> <20150804125556.GA5180@mwanda> Date: Tue, 4 Aug 2015 16:01:37 +0200 Message-ID: From: Geert Uytterhoeven To: Dan Carpenter Content-Type: text/plain; charset=UTF-8 Cc: Shuah Khan , Russell King , "ksummit-discuss@lists.linuxfoundation.org" , Christoph Hellwig , Tejun Heo Subject: Re: [Ksummit-discuss] [TECH TOPIC] Fix devm_kzalloc, its users, or both List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue, Aug 4, 2015 at 2:55 PM, Dan Carpenter wrote: > Another thing which I have seems fairly common is treating it like > kmalloc() and calling devm_kfree() manually. For example, ssp_parse_dt() > > drivers/iio/common/ssp_sensors/ssp_dev.c > 493 return data; > 494 > 495 err_mcu_reset_gpio: > 496 devm_gpio_free(dev, data->mcu_reset_gpio); > 497 err_ap_mcu: > 498 devm_gpio_free(dev, data->ap_mcu_gpio); > 499 err_free_pd: > 500 devm_kfree(dev, data); > 501 return NULL; > 502 } These indeed look superfluous. In some cases it may legitimate, though, when freeing memory not tied directly to the lifetime of the device. Cfr. drivers/media/platform/soc_camera/soc_camera.c, where the operation may be retried later. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds