Received: by 10.223.164.202 with SMTP id h10csp73587wrb; Tue, 14 Nov 2017 11:19:36 -0800 (PST) X-Google-Smtp-Source: AGs4zMaWXfo1u7ki1llnqINqlOVYOD18XtlYxilDXyo4jsEiw8/qijkisvlXaQqJhuh8u3raHzB+ X-Received: by 10.99.49.81 with SMTP id x78mr13386475pgx.35.1510687176323; Tue, 14 Nov 2017 11:19:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510687176; cv=none; d=google.com; s=arc-20160816; b=PhDyH0/Ii9fQBKwJPvFSBRoJHuLUDrXRJFXoqmiISg7GKVcO6VZ1KUWh+JjslQJdt2 nka2XYoLS4OTePBz2jO2AsW0OZCh0hZd1gaO3zIOJUScQyQ0hVWZfMjTSL6Jvui3SIj7 0WeCtfMfZzV+TxVQXoqm10fjSbEnmtLPsHQVaiOhD32XDgKAxPatyn6PdXpwTGKGQph/ V5RwlwV5yQG4cUjYUJAnBJfJl7JmZsH7TojoOFgj2d+CWdYp3ExZVOcPg+T3AWyGGdoj WOODSa1GmY6ln3bKtZOeEIjWz/7mL5eSkRSo4+fGjcKzJfZpSN9mkA40VyvLrRubUxcc om3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:arc-authentication-results; bh=vbw9lFNE+DUBnexNwBqGqL7MlRiOYoEGnASX3rW88nk=; b=EblaSQiNNZ3DJa6zR/xROd/UQa7z+71nDs1mcu3XblNEfCl0fv9xbvn2uvty4Coewk 6MkL2rjlrSixSG1ZHjd7pE6xrHxvHPoNvF2swQkGvtw5l0kDkM2qlH4ccXO5v07ZO9aF EJ+MlQZv3Enz1Eaq98jRekpxq69mY7UAzOGsjj7OIaPLSFwbNvdCJf41GGNemzbJg9ha TL+TcC7TkRudBHSkDMecZ3w9LzTO7LYn8ZPcNlPAO4KL8JHzVhEz0ZbejFsDDSGoQY3a f2ymmQQm4ZS6FuObjgrpOQBXduW5UH8t2wSfCydTMQSml6E/TRJ+3nnCrIgJWUBfsRMW ttJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PU1Bnytf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a186si5371740pgc.699.2017.11.14.11.19.23; Tue, 14 Nov 2017 11:19:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PU1Bnytf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756263AbdKNSkr (ORCPT + 88 others); Tue, 14 Nov 2017 13:40:47 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:53610 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755901AbdKNSkk (ORCPT ); Tue, 14 Nov 2017 13:40:40 -0500 Received: by mail-pg0-f68.google.com with SMTP id s2so15998506pge.10; Tue, 14 Nov 2017 10:40:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=vbw9lFNE+DUBnexNwBqGqL7MlRiOYoEGnASX3rW88nk=; b=PU1BnytflibkIU24pAhmCCy6PUBx5iNpqzbtoBGpPLTocKLegZymu+0B1KGNtGCEVB jErl8lhBpM3VrmpsCqpNjnl52LNf06CLmwEyjOl6/XW4ttzhkhVHLQoDvdrI6gD0qk35 xuMvnu/CP1Y4nYh9nZG6J5+g5M9c3dZHEB5ymlUmQXa7JzvTKra+Iw/qWPph83FLKZrn P1UNnNiv9P6sactfHop3kG7HZxd4Z0dro3tfAt7g5QhR6fV6ErlsrtpwvmFjIl7/D9yS on3DJ5co4oMyujf9oT/ZoqokrFCJiXcHfdtAotn+8pt3v3UYxOU9sIJk9+EU/5bAdHqm 9qiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=vbw9lFNE+DUBnexNwBqGqL7MlRiOYoEGnASX3rW88nk=; b=C5qY18YYXKgH16VMDPyM2o0fx/WkGTRZWiB8mnD9RRh2BromH1EE67Gt/BM9wPfxO6 cONmCRshdCREvX7suV2MctoWDFDm9zJH6dHOduP5aahGg/7JO1jUMlhiMTfeZopPb1AT FOtdo+2Dj3q3MUvGbeUhHFdCvHPRO/is+vFjWVMKXBCq5boMnPUxVv31TA+8x914AR8W rE5AhdMudB+0aEFiHu4E7hQXMrPIlDTbpItypoekJiU+Rkwo31heGEiq0NdyWT26JG1j NhmNZFdzUfk807AXim/UZw109STwIhHRzFd1Eq6hAvTDT5+nGhrIzyt0cpvq51yojzXi p3rQ== X-Gm-Message-State: AJaThX66drYqWag+QJRVaVn6P89PIogPHLHSuXFiMca7coSkfQ6v8kg4 a5Jk1hiCqHhPwEFYkDoYBu4BMg== X-Received: by 10.159.245.148 with SMTP id a20mr3892939pls.202.1510684839500; Tue, 14 Nov 2017 10:40:39 -0800 (PST) Received: from [192.168.0.105] ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id f191sm31506339pgc.32.2017.11.14.10.40.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Nov 2017 10:40:38 -0800 (PST) Subject: Re: [PATCH] Input: davinci_keyscan: Free memory occupied by davinci key scan device To: Dmitry Torokhov References: <9203eaebf020cbebf5224221d789a0163490d654.1510666872.git.arvind.yadav.cs@gmail.com> <20171114181434.lpwhojwemzdruet6@dtor-ws> Cc: linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org From: arvindY Message-ID: <5A0B38A2.4070208@gmail.com> Date: Wed, 15 Nov 2017 00:10:34 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20171114181434.lpwhojwemzdruet6@dtor-ws> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 14 November 2017 11:44 PM, Dmitry Torokhov wrote: > On Tue, Nov 14, 2017 at 07:15:14PM +0530, Arvind Yadav wrote: >> Here, key_dev is NULL in input_free_device() and It will not free >> memory occupied by davinci key scan device. Move "key_dev = NULL" >> after input_free_device(). > No, this is absolutely wrong. It is disallowed to call > input_free_device() after calling input_unregister_device(), because > input core will free the device once the last reference is dropped. That > is why we set "key_dev" to NULL to turn input_free_device() into a noop. Yes, You are correct. Once device is unregistered it will get freed. Thanks, :) >> Signed-off-by: Arvind Yadav >> --- >> drivers/input/keyboard/davinci_keyscan.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c >> index b20a5d0..22cb8d2 100644 >> --- a/drivers/input/keyboard/davinci_keyscan.c >> +++ b/drivers/input/keyboard/davinci_keyscan.c >> @@ -290,13 +290,13 @@ static int __init davinci_ks_probe(struct platform_device *pdev) >> free_irq(davinci_ks->irq, davinci_ks); >> fail5: >> input_unregister_device(davinci_ks->input); >> - key_dev = NULL; >> fail4: >> iounmap(davinci_ks->base); >> fail3: >> release_mem_region(davinci_ks->pbase, davinci_ks->base_size); >> fail2: >> input_free_device(key_dev); >> + key_dev = NULL; >> fail1: >> kfree(davinci_ks); >> >> -- >> 1.9.1 >> > Thanks. > From 1584066318158918411@xxx Tue Nov 14 18:16:03 +0000 2017 X-GM-THRID: 1584052374559156539 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread