From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08D6CC433EF for ; Mon, 11 Oct 2021 14:53:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C441460BD3 for ; Mon, 11 Oct 2021 14:53:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C441460BD3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF9D789FA6; Mon, 11 Oct 2021 14:53:12 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8C56E89FA6 for ; Mon, 11 Oct 2021 14:53:11 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id EB6F360EBD; Mon, 11 Oct 2021 14:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633963991; bh=kbigrBKDcGfRw9vh8QRP3YnmxFFgxeVijtx0SA6WcKY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q5lCtfVThFDRJ8dxh+JODr+/qO5i6Yx7I4SgckEkM98lqxQHBAf/4/7/wq8Rc5F3p 62Qb8lZjjsene/HJi8A0XBbebbZyHVrJDN/Og/CokDXjxn3CIXx4DtH1+wMIZzyMo0 3+dTIqqXzuu+JjaGHfL9JuaWaO+uHj3axu9eIBdo= Date: Mon, 11 Oct 2021 16:53:08 +0200 From: Greg KH To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Christian =?iso-8859-1?Q?K=F6nig?= , "Das, Nirmoy" , "dri-devel@lists.freedesktop.org" , Jani Nikula Subject: Re: Fw: [Intel-gfx] [PATCH 1/5] dri: cleanup debugfs error handling Message-ID: References: <20211008091704.27094-1-nirmoy.das@amd.com> <87a6jjyhuo.fsf@intel.com> <02fc9da3-ebac-2df1-3a54-d764b273f91b@amd.com> <936fed94-e56b-e4a6-6d1d-9830e8907d6c@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <936fed94-e56b-e4a6-6d1d-9830e8907d6c@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Oct 11, 2021 at 04:19:58PM +0200, Christian König wrote: > > > > > And then throw it away, later, when you want to remove the directory, > > > > > look it up with a call to debugfs_lookup() and pass that to > > > > > debugfs_remove() (which does so recursively). > > > > > > > > > > There should never be a need to save, or check, the result of any > > > > > debugfs call.  If so, odds are it is being used incorrectly. > > > Yeah, exactly that's the problem I see here. > > > > > > We save the return value because the DRM subsystem is creating a debugfs > > > directory for the drivers to use. > > That's fine for now, not a big deal. And even if there is an error, > > again, you can always feed that error back into the debugfs subsystem on > > another call and it will handle it correctly. > > Problem is it isn't, we have a crash because the member isn't a pointer but > an ERR_PTR instead. Again, that is fine, you can feed that into debugfs and it will "just work". Treat it as an opaque pointer, not a *dentry and you will be fine. thanks, greg k-h