Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752954AbbKGE4X (ORCPT ); Fri, 6 Nov 2015 23:56:23 -0500 Received: from m50-135.163.com ([123.125.50.135]:51788 "EHLO m50-135.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751021AbbKGE4T (ORCPT ); Fri, 6 Nov 2015 23:56:19 -0500 From: Geliang Tang To: Matt Fleming , Anton Vorontsov , Colin Cross , Kees Cook , Tony Luck Cc: Geliang Tang , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] efi-pstore: implement efivars_pstore_exit() Date: Sat, 7 Nov 2015 12:43:48 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: <337377a3fbcf855d6a5217e06fcd8c8a979f2853.1446869434.git.geliangtang@163.com> References: <337377a3fbcf855d6a5217e06fcd8c8a979f2853.1446869434.git.geliangtang@163.com> X-CM-TRANSID: D9GowAB3Nk+fgT1WG4cFAA--.1533S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF1fJrWUXr48Gr17GFW3ZFb_yoWfWFXEk3 yUJry8Wr1jk3yxuw4Yyr13Z347Ww4kWan5ZasFvanIyryxJF4UJw1DZa4xZanrGFW2yFZ8 A39rtF18Zw4UGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUUtfH5UUUUU== X-Originating-IP: [116.77.145.83] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiGQCrmVXlPFwlYgAAs8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1090 Lines: 37 The original efivars_pstore_exit() is empty. I 1) add a bufsize check statement. 2) call pstore_unregister as it is defined now. 3) free the memory and set bufsize to 0. Signed-off-by: Geliang Tang --- drivers/firmware/efi/efi-pstore.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c index eac76a7..62d57d8 100644 --- a/drivers/firmware/efi/efi-pstore.c +++ b/drivers/firmware/efi/efi-pstore.c @@ -393,6 +393,13 @@ static __init int efivars_pstore_init(void) static __exit void efivars_pstore_exit(void) { + if (!efi_pstore_info.bufsize) + return; + + pstore_unregister(&efi_pstore_info); + kfree(efi_pstore_info.buf); + efi_pstore_info.buf = NULL; + efi_pstore_info.bufsize = 0; } module_init(efivars_pstore_init); -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/