Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751905AbcDRQQ7 (ORCPT ); Mon, 18 Apr 2016 12:16:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:43121 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750813AbcDRQQ6 (ORCPT ); Mon, 18 Apr 2016 12:16:58 -0400 Date: Mon, 18 Apr 2016 09:16:50 -0700 From: Davidlohr Bueso To: mingo@kernel.org, peterz@infradead.org Cc: waiman.long@hpe.com, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH -tip 3/3] locking/pvqspinlock: Robustify init_qspinlock_stat() Message-ID: <20160418161650.GA25176@linux-uzut.site> References: <1460961103-24953-1-git-send-email-dave@stgolabs.net> <1460961103-24953-3-git-send-email-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1460961103-24953-3-git-send-email-dave@stgolabs.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1049 Lines: 32 On Sun, 17 Apr 2016, Davidlohr Bueso wrote: >diff --git a/kernel/locking/qspinlock_stat.h b/kernel/locking/qspinlock_stat.h >index 72722334237a..ddcd653c942c 100644 >--- a/kernel/locking/qspinlock_stat.h >+++ b/kernel/locking/qspinlock_stat.h >@@ -225,12 +225,18 @@ static int __init init_qspinlock_stat(void) > * performance. > */ > for (i = 0; i < qstat_num; i++) >- debugfs_create_file(qstat_names[i], 0400, d_qstat, >- (void *)(long)i, &fops_qstat); >+ if (!debugfs_create_file(qstat_names[i], 0400, d_qstat, >+ (void *)(long)i, &fops_qstat)) >+ goto fail; >+ >+ if (!debugfs_create_file(qstat_names[qstat_reset_cnts], 0200, d_qstat, >+ (void *)(long)qstat_reset_cnts, &fops_qstat)) >+ goto fail; > >- debugfs_create_file(qstat_names[qstat_reset_cnts], 0200, d_qstat, >- (void *)(long)qstat_reset_cnts, &fops_qstat); > return 0; >+fail: >+ debugfs_remove_recursive(d_qstat); >+ return 1; Hmm actually if debugfs_create_dir() fails firstly, we still return 0, Waiman, did you mean 1 there, no? Thanks, Davidlohr