Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2652536pxp; Tue, 22 Mar 2022 03:18:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym8zaUNBWIXj6WbqwFoOE9Z/fFCDMM9QxiqLNkeyT2yDcmw+a/MG3iy54htJe6ALEoR9Jz X-Received: by 2002:a63:df58:0:b0:381:6713:6a49 with SMTP id h24-20020a63df58000000b0038167136a49mr21042927pgj.198.1647944311786; Tue, 22 Mar 2022 03:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647944311; cv=none; d=google.com; s=arc-20160816; b=H7Pyvo3A9Ja2PGbVetavmI3TUqEMKiMaIJM1r1HicS309ir9hfW7pM2UqT0yaAY10X QZvFLRQPvuGFhP2VjAN3acoCCvWrimY7H8i6InDLaYWa6zsw8noL6OVPdIQSqX8nw6yL YrbVMGTsck+E7TaGM+irlton6lIxcFD2G+KrBMrwPJpmJ7tV/vAURUEa3ScuEnhEPiIc fIjeo6Ze72QJsOePmDY1zyNqd9OsL2rvktQb/TXtLsFtG968KFO7BqggGU24KN42Meu6 2ld6SYrY2RkZFm8Aa0vYlK7GYUMOFbutBz0CQ80zHZhQ80GyEOrg773x+IjEb6VP9RrY GLNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=X99bYtMPXK/lUQRyXYEMc82PYA/a9iPeIbyvT5Yw/Y4=; b=EotcLZ135NSjAURH1jbTptS4AylhnO6OXOk5bjQSezDYj3VPr3Vo14yFfIOsknxXgZ SL6WSQd7DvlUJrIpy6P/kQBSUZxZU3b2SBHZMTwBWGXnVWz2sHua+RsE2gNvSNz0GnxU 84Rr6TRcBOnkfFpAIvUecsFKE/6uuf2Nr1Q4k98ePN1B1x4Xo7Py7HjoQgLe3P0x9ScH oIrPH9eUAHBSvV/nUbjvSs/Y/OxNVyBtFOtRWeUxp3FJzpS8tZ1Fcsk1TTBU1w/1FkBG yTwwVNwCaZ5rC9EHSJ9eVkv3FMaPu6UhChEKouVVx0csmKTHV3ws4axYg+alS6m+msQY +W0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kjzsyGVF; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a635b0b000000b003816043ee8bsi14571888pgb.128.2022.03.22.03.18.17; Tue, 22 Mar 2022 03:18:31 -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=@gmail.com header.s=20210112 header.b=kjzsyGVF; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231434AbiCVIkf (ORCPT + 99 others); Tue, 22 Mar 2022 04:40:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231432AbiCVIkc (ORCPT ); Tue, 22 Mar 2022 04:40:32 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54E5F17AB9 for ; Tue, 22 Mar 2022 01:39:04 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id h1so20752279edj.1 for ; Tue, 22 Mar 2022 01:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=X99bYtMPXK/lUQRyXYEMc82PYA/a9iPeIbyvT5Yw/Y4=; b=kjzsyGVFO7n/ps8vT3T+52rxTOI3jY2t4UGftFX6Dtm8CrsMtWfqW64D0NbY1KpUuR jdxGVxIa88gbx79Sk52K8S8NW2HRlfKnjYPVqvF8NYUPt+I3CEtqMyxVhYYuW5W+vm37 TgSCx1X8nvHFVASN7iSujEpSLkonNCyxDyUi30caOnYTIo1WWoHgKoxRviJpAVa1TdH8 hh3/+J3r2akg4O/LDR7iHSIDypgp6iGeiX68pb4XD8EPB7vNijFw/2YUo4+Zg7RKIjua 1ZvETy+DeS/IcM+O3CUR+AOnxe7HaBuGeZTcyfp6U+MzK7FS9MVRGwc0WOFqu8N7y6dE Ny6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=X99bYtMPXK/lUQRyXYEMc82PYA/a9iPeIbyvT5Yw/Y4=; b=7tPNdLZH0mhHSZJerVjRPGpFHmqnC/WTtlA4vjhOyzNRiGfPNclf0Znh9Y5QHArCpA lDLs91OykNhPHAsDdep6hs71boA91WkBg+man2ulNPYzqqYvgLlay8ztmC1kNRDQoZd6 irnQQgVA5hRohOBzNbM0j7esnIG6akgvYEW0dtuyqZIAZ1cNbJ9wehMtNO8zXtgFE7W+ huKf1znEnPk4/cq74NvF4OSIE1j7Nk6IiiOD0sS/uZcyTDRLIsgJZZq4nTC22YH6FBZ6 jNJt3spwxZQnoyevor2tRTRL/56Y0ZEAYCxjf/IQVbmj7xmvoHY6oKq39CyH24LtSQ4c 0bgg== X-Gm-Message-State: AOAM5329DHSaheyhdvNtn7CIH+qkLcKIqA3ixb7fgT2VExCv0my/zivb aX7w/DpOnxNPRnWzS14gstM7PWLc+xI= X-Received: by 2002:a05:6402:280f:b0:419:4c6f:a91b with SMTP id h15-20020a056402280f00b004194c6fa91bmr6438066ede.84.1647938342706; Tue, 22 Mar 2022 01:39:02 -0700 (PDT) Received: from localhost.localdomain (host-79-37-100-169.retail.telecomitalia.it. [79.37.100.169]) by smtp.gmail.com with ESMTPSA id do8-20020a170906c10800b006dfe4d1edc6sm3631131ejc.61.2022.03.22.01.39.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 01:39:01 -0700 (PDT) From: "Fabio M. De Francesco" To: David Kershner , Greg Kroah-Hartman , sparmaintainer@unisys.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: "Fabio M. De Francesco" Subject: [PATCH] staging: unisys: Properly test debugfs_create_dir() return values Date: Tue, 22 Mar 2022 09:38:58 +0100 Message-Id: <20220322083858.16887-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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)) { dev_err(&dev->device, "%s debugfs_create_dir %s failed\n", __func__, netdev->name); - err = -ENOMEM; + err = PTR_ERR(devdata->eth_debugfs_dir); goto cleanup_register_netdev; } -- 2.34.1