Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2471500rda; Wed, 25 Oct 2023 03:57:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHgY9NAK/QuyvzbYlFbhxB2R49+hHAIoYzludqQ3X8UEHQXCNI4G4eRx9Y+6Dqfv26Xmuk5 X-Received: by 2002:a25:5007:0:b0:d9c:7c97:7fcd with SMTP id e7-20020a255007000000b00d9c7c977fcdmr13062312ybb.27.1698231466678; Wed, 25 Oct 2023 03:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698231466; cv=none; d=google.com; s=arc-20160816; b=PMUyDVwx3pvkViZYVVmV/35+RWV/gg1QGxD8rOvhPuuIk6TlbVLRbizOcpp7qVnmCx oFkld5+BouJSQuHTwB8CwokTGaQBxx80FgIYXTWPyRBKSpBkDqIfRsFk4XToqVWESjgJ fO2GhOlD7xnSBwYV7qsKFxMklQC62xD6QSpYsfeDWS0uHhkXkgJeG8U2PlMP2ARCbaVr SHO4jsyZsq7HzvbvDu0vEw1jL6vvnw5YGSoN73xZtB8H7iG8VHeaJLEboZsx7l2aRNGi Sq6Uf2oTASpQdyOJqb90XmaHJEnEoZMpAvrt0if+YKHyzGOn9K7hUbnqdlXv+wV308AF 3Sog== 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=R5GXEjEuiD6mlb1HkOp16QUm9TOrY8LB9EQXmZOtIkI=; fh=gze3pOWaTIsiTOnjFUpcbZ8hbKEplxw1dV8sBvA1+Dw=; b=FZDJnACxaOXnWC2k8vNGoWyp/2YTOtyN9UHIlZVPoGwpu1TNLa5gvN6cm6BUDOAnhw 8atEa2uI4dttnNn4zVn61BXZJRcZCo2+5iawbwQ8y3iVoqru5EyEcIs75/aCRfl4LlTr aPh7Ds39R6Lmx2ByyWRaQTleszUo7A3KCgpxVlV+aOqSA46qXSCj9/nTihHfoVwTXGKa aW0ls5FXCNy8VFqDEhUq2eg19QvO8ieZ4715w261LIpQmvonyC90dBnn2v6z/a9u8LrJ NDnGk3kXp1JawxzqqkT1StOxATbT9rRyBk/4nZq8snzSeeSU4COJ2uch8BvqLojm01Hs ybMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YuxgknuU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id 204-20020a2501d5000000b00d9a49bb5ce6si10098449ybb.598.2023.10.25.03.57.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 03:57:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YuxgknuU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0038880C4D67; Wed, 25 Oct 2023 03:57:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232076AbjJYK5h (ORCPT + 99 others); Wed, 25 Oct 2023 06:57:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232272AbjJYK5g (ORCPT ); Wed, 25 Oct 2023 06:57:36 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 823C4BB for ; Wed, 25 Oct 2023 03:57:31 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-99c3d3c3db9so820552566b.3 for ; Wed, 25 Oct 2023 03:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1698231450; x=1698836250; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=R5GXEjEuiD6mlb1HkOp16QUm9TOrY8LB9EQXmZOtIkI=; b=YuxgknuUxuP9OHDk7r9JN9qjmH88pRkWJE+kM7sw2fuxlwVz2neSpTifhYGZcL2Lys oAcTrTrwkpNdGwgdlHbcGeroMx/BiIFmrRh95AjkQcIfNywhaBCiHUeoyY1tGkyr5tvr yM9CdSyXfFX06wcbYS0TLrD6ROjdbbsGWuxMw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698231450; x=1698836250; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R5GXEjEuiD6mlb1HkOp16QUm9TOrY8LB9EQXmZOtIkI=; b=O7NmCbydT4abOGKWK5mcMSqubx6EldJRGD0nVTvFBj/yT0YAfn/KCMbLFzZ4mKKmh8 sWS5fRRmcTZkXAP/wrpwrboFPEwMmpkY4P9na9ELImcNvSevx7GWDXCI/KYjzHbl0qCX Ctk1yar7W6RufHCieGYZBEo88ZQlHOJKJ8HSDqWxfAoIIdYY7KH3d3Zo7hpd0airAE2F 1JyWDN62C3qwg00PJhCGT0WRpB2n8PyioW6sHVPbdnok9LfPD290nhDe65tboKBwPRAT UtIp3Tn4trseKpSlWcOnqUc8r7U2S3jtYT4JPmMN12pLGIKoT2YVoy2wRdJV4OT5HLgg vWOA== X-Gm-Message-State: AOJu0YwUGh1hpIwB9+Dgl7tGVGPDVt+Fe1rfK2F4QJCZxIdN6/fXFO6n 4fl+aTIIYTJRjbPUylrtTb9h45GByOTd7cVheJtmOA== X-Received: by 2002:a17:907:c21:b0:9bf:80f0:7813 with SMTP id ga33-20020a1709070c2100b009bf80f07813mr12624049ejc.16.1698231449769; Wed, 25 Oct 2023 03:57:29 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-50-51-252.retail.telecomitalia.it. [82.50.51.252]) by smtp.gmail.com with ESMTPSA id xa17-20020a170907b9d100b009b913aa7cdasm9741317ejc.92.2023.10.25.03.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 03:57:29 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Dario Binacchi , Jens Axboe , linux-block@vger.kernel.org Subject: [PATCH] pktcdvd: fix error checking for debugfs_create_dir() Date: Wed, 25 Oct 2023 12:57:12 +0200 Message-ID: <20231025105725.2033975-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 25 Oct 2023 03:57:44 -0700 (PDT) The return value of debugfs_create_dir() should be checked using the IS_ERR() function. Signed-off-by: Dario Binacchi --- drivers/block/pktcdvd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a1428538bda5..6a9decb04ac1 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -497,7 +497,7 @@ static void pkt_debugfs_dev_new(struct pktcdvd_device *pd) if (!pkt_debugfs_root) return; pd->dfs_d_root = debugfs_create_dir(pd->disk->disk_name, pkt_debugfs_root); - if (!pd->dfs_d_root) + if (IS_ERR(pd->dfs_d_root)) return; pd->dfs_f_info = debugfs_create_file("info", 0444, pd->dfs_d_root, @@ -517,6 +517,8 @@ static void pkt_debugfs_dev_remove(struct pktcdvd_device *pd) static void pkt_debugfs_init(void) { pkt_debugfs_root = debugfs_create_dir(DRIVER_NAME, NULL); + if (IS_ERR(pkt_debugfs_root)) + pkt_debugfs_root = NULL; } static void pkt_debugfs_cleanup(void) -- 2.42.0