Received: by 10.223.185.116 with SMTP id b49csp3673022wrg; Tue, 6 Mar 2018 03:06:50 -0800 (PST) X-Google-Smtp-Source: AG47ELu7i14QL9PAzXo+srQDpFuJXsDxnhteDI+QjBQX2p9ZHPypI9v0ixQlfNCHpyqEliHUZOJh X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr16668953plb.113.1520334410036; Tue, 06 Mar 2018 03:06:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520334410; cv=none; d=google.com; s=arc-20160816; b=lxphoSYWEugNnqsCvsfrZYLeXeRy+0xWozmtxj8VVn8S/42yIqIAtU5+tIWVQj629c 351HjD/CjeqFzK1jLydBJcZMgwfxbsVkqvwBT9qWIzj/Myaaifi+mKKnMt8JFD6Ilxwe 1/C7PCmVME29H1Hs9TFiMyqirUVuu9AH6vzewKqJeCZ+CTNxGTuUKLy1dOI+Wt2GavhY E4YFRxO9KqTAwSuuA/qEf+DckRwou2zObWwCkEZQMbR7LJaN2WppGit+oeWlxiAFirzf LlyxBFlZaUKFi3KXDZ66iXB8oSVu+QjrERrOYg1qdPObf6+SPIBszeC6eshjC3S4KJjY KOhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=hEhY7n8iduYHu3quSCGXXo87gyfMRQrJ4IQ65g67uFo=; b=MzguXWusV+7cq9Bd/Q2Q6F5jSUJYbzTNDJjZuncPrcE7tRkzC87lyffljfYXiBX9bT vD7C8rLsmqHjJ+0Gw80OHXOKkD/SFZCnwTUlAu/H+Z2FF2L6t5YArRHfxtZS6xrL1fYR GoEt1L47LCZI8nmTfqo5Af2Ku31cIIxf4Z8mTi0GNrUzFQHYvDvGPXM3YMBVT6Qf1kTH HIUbL0IrZmbpDsNjviWWTMkezXUWXqFEGbxB5g8y7+tKr/+hKdKDzD43sU/CZOn6SI4E 2KyiKjdT00faPdjGsKD/3XBxi+fqauy2s9P/XylhB3L8uL1ETtan2giW6LWv5nA880bP MqxQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si10823519plr.241.2018.03.06.03.06.35; Tue, 06 Mar 2018 03:06:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753423AbeCFLEa (ORCPT + 99 others); Tue, 6 Mar 2018 06:04:30 -0500 Received: from regular1.263xmail.com ([211.150.99.131]:60015 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753291AbeCFLE1 (ORCPT ); Tue, 6 Mar 2018 06:04:27 -0500 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.130]) by regular1.263xmail.com (Postfix) with ESMTP id 9E12C5E8A; Tue, 6 Mar 2018 19:04:20 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id D753A3AA; Tue, 6 Mar 2018 19:04:20 +0800 (CST) X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: cjf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 386053JVIQ; Tue, 06 Mar 2018 19:04:22 +0800 (CST) From: Jeffy Chen To: linux-kernel@vger.kernel.org Cc: Jeffy Chen , Greg Kroah-Hartman , Mark Brown Subject: [PATCH v2 3/3] regmap: debugfs: Free map->debugfs_name when debugfs_create_dir() failed Date: Tue, 6 Mar 2018 19:04:03 +0800 Message-Id: <20180306110403.14438-3-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180306110403.14438-1-jeffy.chen@rock-chips.com> References: <20180306110403.14438-1-jeffy.chen@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Free map->debugfs_name when debugfs_create_dir() failed to avoid memory leak. Signed-off-by: Jeffy Chen --- drivers/base/regmap/regmap-debugfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 5479a183248f..55e862a81e82 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -582,6 +582,9 @@ void regmap_debugfs_init(struct regmap *map, const char *name) map->debugfs = debugfs_create_dir(name, regmap_debugfs_root); if (!map->debugfs) { dev_warn(map->dev, "Failed to create debugfs directory\n"); + + kfree(map->debugfs_name); + map->debugfs_name = NULL; return; } -- 2.11.0