From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752838AbdCFHQG (ORCPT ); Mon, 6 Mar 2017 02:16:06 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:35953 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752734AbdCFHPu (ORCPT ); Mon, 6 Mar 2017 02:15:50 -0500 Date: Mon, 6 Mar 2017 08:09:00 +0100 From: =?utf-8?B?TWljaGHFgiBLxJlwaWXFhA==?= To: Andy Shevchenko Cc: Dmitry Torokhov , linux-input , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] Input: sparse-keymap - use a managed allocation for keymap copy Message-ID: <20170306070900.GA1372@ozzy.nask.waw.pl> References: <20170302120242.6342-1-kernel@kempniu.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Thu, Mar 2, 2017 at 2:02 PM, Michał Kępień wrote: > > Some platform drivers use devm_input_allocate_device() together with > > sparse_keymap_setup() in their .probe callbacks. While using the former > > simplifies error handling, using the latter necessitates calling > > sparse_keymap_free() in the error path and upon module unloading to > > avoid leaking the copy of the keymap allocated by sparse_keymap_setup(). > > > > To help prevent such leaks and enable simpler error handling, make > > sparse_keymap_setup() use devm_kcalloc() to allocate memory for the > > keymap copy so that it gets automatically freed. > > > + * Since sparse_keymap_setup() now uses a managed allocation for the > > + * keymap copy, use of this function is deprecated. > > So... > > > */ > > void sparse_keymap_free(struct input_dev *dev) > > ... add __deprecated then? Sure, I can do that if Dmitry recognizes this patch as otherwise sane. I have never used that attribute before, so thanks for the tip. -- Best regards, Michał Kępień