Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2656246pxp; Tue, 22 Mar 2022 03:24:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPeLqt2eA6Z2YtlIUSbDeMCa49NXNLScoj8sbYqkPHnX+vC5kgsx38DuLPi4YIuSyXUkvT X-Received: by 2002:a05:6a00:130e:b0:4f3:9654:266d with SMTP id j14-20020a056a00130e00b004f39654266dmr28177769pfu.59.1647944681694; Tue, 22 Mar 2022 03:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647944681; cv=none; d=google.com; s=arc-20160816; b=IrOdBCjOOHgj23dEaZbOhhOt33xq1OBEQYSN601+QGWFN3UOmnXIbFpFAT2Jl2/ah7 MqzGeBMTBGhGFu5M2hpyjaocA/kdaCJP97RvLZul4qCrBwUUyIcSgfZGYZMYKDAJ5cGc MELtRJKZGkLIYsCggHpKI1b4BJFSp8CO8NPIlXYDiu72PSEDQiCtc8rxDM57Z/ZGpmGY 7KCHQQSL/N8TaGOLODFYqBBQBddB48UEVb1cBBSO+c26+xmXExWGrUqPWb0h/OWwf3xT 5wFlXYeELSw985bf98Ru8Hld4749PyTCQr/8bEC65fwPYYjb5qNd6qA8vWsnPV/zN4af Vj7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EjewUPEOv/3beWURhUOhcgpxCS8zQyATKWwmddES9Sc=; b=iKbabQzmRWFqEjY9sWKrIvt08OeX9vFo+OjJN+tXHx71IGLwz9VNpZbyGdRX+brTkM xKv89BmAG7ydI2ujlLMkisCAoDAftXylgSIW6IAo7WlelxA7HEsl7SLTcqD7iqrolGaH 7hQkSUXTfZpD+BekqRVD1O9uUcdfDBYtQ2Fb+/5ow0uw8lg7RIBPPb+PHifB8vFWHMbm yMkwD5xnSaxWzU5mFbaBwae127XGVNJheulwNkE9UCenhoinxhFV5CZcR0h21M13A7E+ DfT9tsFI5vmZmIqlbHmiyUWqj+DzkLhHmwDzPliPoaI10EsXlCVhtMNnoXDfNRxAYH1R 83WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vr2C7oc0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n4-20020a635904000000b003816043f14esi15592205pgb.835.2022.03.22.03.24.28; Tue, 22 Mar 2022 03:24:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vr2C7oc0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231666AbiCVJFy (ORCPT + 99 others); Tue, 22 Mar 2022 05:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231515AbiCVJFq (ORCPT ); Tue, 22 Mar 2022 05:05:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A67AA44A2D for ; Tue, 22 Mar 2022 02:04:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D7D4B81C16 for ; Tue, 22 Mar 2022 09:04:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C83D2C340EE; Tue, 22 Mar 2022 09:04:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647939857; bh=bATFr0wq7Cf/1RkRBizWVvZl0hCoNH8ejbumoz6bjao=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vr2C7oc0EQ5iqRCtm3aE6rhKGaJ42gHatF7i8FMLy6ZHnyK0tpMpho+KPuj+ov6FS xZsS0s620vkSt6Kak2CPgn3FARjH3w/O34yKzJrhJnmdscG5WoOHwOqFO7xB9UZiKs ouauTcvv3lDLdpvOHKnKDLVTxbeGjkd6bxP2kMgA= Date: Tue, 22 Mar 2022 09:47:29 +0100 From: Greg Kroah-Hartman To: "Fabio M. De Francesco" Cc: David Kershner , sparmaintainer@unisys.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: unisys: Properly test debugfs_create_dir() return values Message-ID: References: <20220322083858.16887-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220322083858.16887-1-fmdefrancesco@gmail.com> X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 22, 2022 at 09:38:58AM +0100, Fabio M. De Francesco wrote: > debugfs_create_dir() returns a pointers to a dentry objects. On failures > it returns errors. Currently the values returned to visornic_probe() > seem to be tested for being equal to NULL in case of failures. > > Properly test with "if (IS_ERR())" and then assign the correct error > value to the "err" variable. > > Signed-off-by: Fabio M. De Francesco > --- > drivers/staging/unisys/visornic/visornic_main.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c > index 643432458105..58d03f3d3173 100644 > --- a/drivers/staging/unisys/visornic/visornic_main.c > +++ b/drivers/staging/unisys/visornic/visornic_main.c > @@ -1922,11 +1922,11 @@ static int visornic_probe(struct visor_device *dev) > /* create debug/sysfs directories */ > devdata->eth_debugfs_dir = debugfs_create_dir(netdev->name, > visornic_debugfs_dir); > - if (!devdata->eth_debugfs_dir) { > + if (IS_ERR(devdata->eth_debugfs_dir)) { We really shouldn't be checking this value at all. There's no reason to check the return value of a debugfs_* call. Can you fix up the code to do that instead? thanks, greg k-h