Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755499AbbHYHxc (ORCPT ); Tue, 25 Aug 2015 03:53:32 -0400 Received: from mail-la0-f52.google.com ([209.85.215.52]:34710 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755465AbbHYHxX (ORCPT ); Tue, 25 Aug 2015 03:53:23 -0400 From: Alexander Kuleshov To: Andrew Morton , Joonsoo Kim , Michal Nazarewicz , Sasha Levin , Stefan Strogin , Dmitry Safonov Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Alexander Kuleshov Subject: [PATCH] mm/cma_debug: Check return value of the debugfs_create_dir() Date: Tue, 25 Aug 2015 13:52:34 +0600 Message-Id: <1440489154-3470-1-git-send-email-kuleshovmail@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 898 Lines: 31 The debugfs_create_dir() function may fail and return error. If the root directory not created, we can't create anything inside it. This patch adds check for this case. Signed-off-by: Alexander Kuleshov --- mm/cma_debug.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/cma_debug.c b/mm/cma_debug.c index f8e4b60..bfb46e2 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c @@ -171,6 +171,9 @@ static void cma_debugfs_add_one(struct cma *cma, int idx) tmp = debugfs_create_dir(name, cma_debugfs_root); + if (!tmp) + return; + debugfs_create_file("alloc", S_IWUSR, tmp, cma, &cma_alloc_fops); -- 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/