Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp6007161rdb; Mon, 18 Sep 2023 00:35:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8W7EXcVbnbx1nMAJp8Syf7cPn2St4iSO19y696RU6D+edIIsgEWncYS5JXEYWDOu3g1FV X-Received: by 2002:a54:4097:0:b0:3a7:46d2:5203 with SMTP id i23-20020a544097000000b003a746d25203mr9384423oii.51.1695022531518; Mon, 18 Sep 2023 00:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695022531; cv=none; d=google.com; s=arc-20160816; b=uz3ChoKMDDAfTbeKG5QR2SC6xOPGefE8TCmQyinKacbB5DvOJxMSxyrMe7GIN3YmFz 8UkF96dOskRUP9sldE5bHU0fj1IlL/htIyKV9q/NZiIPtrP1gyIko6KGeGaKy8TnR2q1 H6fKp/R1Jr0HyEe0mdgbkntrwqd+Y+usukspixzqY+u0izmYVN6huZTCEfWKG1dd0q5u YW59L14rYJHOhxfNlT3cqa3BGFFdHhaIAnn8hG9Ar4Au0RWIdRArwU3aa0MD0SYRXABF sTChQqtrHSw0LQy9xw9MLTHOkDDWf3tFktJjLUyd0a7Sv/pREu0nBHizdk+O3IN0RknT V4Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=n5GOty1FZm3dW6STDTU4IzxaJuBtMC1qUI5dLmOz7Vg=; fh=sfMJSpRnxCzI1LOJGrB6RoQyaiVGI1X2CZEx9D1rtts=; b=yN5oIkG8aw1u/FffUr0Gg995LOVU2tq4u1RATTN3RQTGnnxdFHKg2WHUN7E7CA38NH uhj+t8j8rOeuP8k6eUQfiN5+xeIeKLDHLXR9iUOzEJjlwhcZo5PSD4WR3iOxlC0BNFku HNwkr3snhC9VCW4ZrBqvlV2Ioxlq4gMnEbOPpm/lYD8y3gHf1QaYxqxSDebTfLcp+sUZ RoBwUoIjKShUQn1oipSeCM8IixVJMDlPFW1z43gALmrm59QS8uhVovne5EjBB7NGRnCA FFUDeiV8yESoDjnod7TaQH2MbqevBdyX61j1WUVApXkidUJ2jD3yrlq1UXq46op5EGea 3c0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=Co20ujl7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id a9-20020a656409000000b0056bad7762c6si7710810pgv.226.2023.09.18.00.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 00:35:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=Co20ujl7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 5E472821148B; Sun, 17 Sep 2023 11:13:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbjIQR7S (ORCPT + 99 others); Sun, 17 Sep 2023 13:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236836AbjIQR6t (ORCPT ); Sun, 17 Sep 2023 13:58:49 -0400 Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BEBB12C for ; Sun, 17 Sep 2023 10:58:40 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id hw2MqAKVBUbVihw2MqRYG1; Sun, 17 Sep 2023 19:58:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1694973512; bh=n5GOty1FZm3dW6STDTU4IzxaJuBtMC1qUI5dLmOz7Vg=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=Co20ujl7wd3fI3AqepZdv+qa/OQOhrYcmkE48an/tSGeexYfljBIas7OjH3X+rAg/ BnXA0DNr1dQ3qiFLAwcIZwUItWUBTxHwJdr96ajCHJk+i5lMbX1vm+XZf8+TZs1BDK xd7CmWBYFCloEHCwRNIC7LdVwn544+a3kbbxwP1E4rVveJXk2GxkiiV3OrMz+RqKb2 HgDSLGs2Ygn0XDXEWh8S6+HozzZ2UVodzyEz4LejBiICDak3eqJDth1frJZ0IFEh5B qaftgOsL2kCkruvnCVU+ltasDkTxxFwSbHaQNFDutUmnHZu5LwAgubs011SyXxrI9M WpPt4H1FAOXTw== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 17 Sep 2023 19:58:32 +0200 X-ME-IP: 86.243.2.178 Message-ID: <0e2e0e8f-91dd-b458-e39e-b00baf98b4e0@wanadoo.fr> Date: Sun, 17 Sep 2023 19:58:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 2/2] Input: add Himax HX852x(ES) touchscreen driver Content-Language: fr, en-US To: stephan@gerhold.net, Jeff LaBundy Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, dmitry.torokhov@gmail.com, jonathan.albrieux@gmail.com, krzysztof.kozlowski+dt@linaro.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, rydberg@bitmath.org References: <20230913-hx852x-v1-0-9c1ebff536eb@gerhold.net> <20230913-hx852x-v1-2-9c1ebff536eb@gerhold.net> From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Sun, 17 Sep 2023 11:13:04 -0700 (PDT) Le 17/09/2023 à 18:37, Jeff LaBundy a écrit : >>> + error = input_register_device(hx->input_dev); >>> + if (error) { >> >> input_mt_destroy_slots() should be called here, or in an error handling path >> below, or via a devm_add_action_or_reset(). > > This seems like a memory leak in every touchscreen driver; maybe it is more > practical to have the input core handle this clean-up. > > Other drivers can and do insert other return paths between input_mt_init_slots() > and input_register_device(), so it seems that we cannot solve this by calling > input_mt_destroy_slots() from the error path within input_register_device(). > > Maybe a better option is to update input_mt_init_slots() to use device-managed > allocation instead? I think that devm_ is the way to go: $ git grep input_mt_init_slots | wc -l 82 $ git grep input_mt_destroy_slots | wc -l 6 I'll send a patch for it. > >> >> It should also be called in a .remove function (unless >> devm_add_action_or_reset is prefered) > > I think the remove path is OK, as input_dev_release() handles this for us. In > case I have misunderstood, please let me know. Agreed. I missed that. CJ