Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2661378rwd; Wed, 17 May 2023 12:36:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7q+H2PbMryGqDHGB7U0OnTwhPT0ul7rpW8psctSunjPKhIa/ld3LwK4URoLOhfdqaHPMXx X-Received: by 2002:a05:6a00:10d1:b0:649:dd0d:69d1 with SMTP id d17-20020a056a0010d100b00649dd0d69d1mr844605pfu.31.1684352212741; Wed, 17 May 2023 12:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684352212; cv=none; d=google.com; s=arc-20160816; b=OUtB4TQRKFFZjOXVy+lWcaw5fN2it/9g/4OCwY3ZT3WM9NG0Uq7wnHw8KUr8KlCbDX ShBb1lV2EA39u3OdMTal5weTLYOdJKGaLI6XIao2WU6NG1hLpZufGvHnHJNEIBqqOwIU qTvn7WShtCbbF96wMKtXX0hEoxFjoGWW6oi+mn9ZjyysEeivnbCdv8lyWj0JXm5V3rrg O3k9kz9KkX+4sGLEh3o6Xr9WhL33h9T5upRW+DInpULcki7ORcywg8/a4r8OxbjPimgV CXS6gMvZdwT9bfvdfw7yFEjgcLbs7Jwaa3oX7lYnGh0S8RVmZvYgC5U/5QJj4LNURsph tUtw== 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=MTGzcnwjQ4xJ2Wkwnqn9RSpjpoInTurXDa8iPfKEJtc=; b=F2H9jycdAnovNVtlkhH9/vkuuXu3AhaTxJEORYxFywjyQd2oYS6rRnZRfRfAh2lm3F C/69ngn8Iqf7wwyihw9i4dkcSdViB2Dicq9oBRDiboyRgsBvrEhdieuVqIemSktFa+FR 6WtCPx6mlzVy02kKx1IGzF98IuiPrPmeMFUZI7M457YhDTwUgD8bWCeaAURBUIraU+qi YcIsGUHTACuytYNTzh8lrYPS4DimioTkegqxlN+aEkXK3/ulS9je7UrPpxLCxs8qsi/E /Kad6BPJB1MyMNctMqyiqnI1S9BQlvGIqA1t8qlyvzZokqgMW+JZZhUnJ2gkq7j7VsTW EvvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=KVITzgib; 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 v29-20020aa799dd000000b0063d270ccc12si23036210pfi.180.2023.05.17.12.36.37; Wed, 17 May 2023 12:36:52 -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=20221208 header.b=KVITzgib; 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 S229591AbjEQT2s (ORCPT + 99 others); Wed, 17 May 2023 15:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjEQT2p (ORCPT ); Wed, 17 May 2023 15:28:45 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65787A5D7; Wed, 17 May 2023 12:28:10 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1ae4c5e1388so12985685ad.1; Wed, 17 May 2023 12:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684351686; x=1686943686; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MTGzcnwjQ4xJ2Wkwnqn9RSpjpoInTurXDa8iPfKEJtc=; b=KVITzgibmYp4fo0QtLoUgDa7cy8blgbnz8iO4lnJmyH8vFLBso+EocArB8Tom9nZ8g 1l9OaWFsuXa5pmrIqApOBBbuFNL5iidzM2mSyWBa59SqS0bWrQuw7KUemiE6LH3hLmvQ Z5GPjuGgixcQn2vYyaS5qPofqtWLhUmMX5rySbBssivDkJzgwAp6BQD7bNNj/iiMbPAt UD29S7TRwapkEoVg28+jib9gM/n4RAWvd2J9wwIUxn448X+V/6H7iZC2I5cJzJ3cs2ig GCG9Y8+K7P4jVatLpEGzCrh1JmoY+1/clgKOFRU0c/Uiqip/X1oM4mmd3zzH98zohXqP JvVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684351686; x=1686943686; 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=MTGzcnwjQ4xJ2Wkwnqn9RSpjpoInTurXDa8iPfKEJtc=; b=dQp8khIM+9hlg4BZWv6FYGihGJCvaszLkhFv3PMV3f+gOW9O0fYBFgfhxyrZxxQBrA bMT7/srGxQnP1VmztKS41qqlWiyROylFLScYCws6ayzx5+HPGSTWRFn8V9Xy17pmBh9w NkLJg9pISIhNbxGMhg6fodMUi/I5pHQg7l/Sg6U0kiNeT2OgXFCCDRUSJE8/FemCFeOz X1/+EE2zLd8FPuhHkMZM14i0jgdovWXdutDETzBPWd/W9y3UpPL2pEkjXsaAKdtD1MPM 5FdgMmiMacpKVKR4/A5Adjw8APkmkf/6QNqEXvRByK4wBkS4iVrmf3IFIc3SQ2EiPhfJ 7aCw== X-Gm-Message-State: AC+VfDw6RmWEIGD9jHe9hn/Ch/mwPBT8TtOxIR9WbOajQ6bnl9E7id8u yxVwlGYwUplhDeU9KlvFuB8= X-Received: by 2002:a17:902:e5d0:b0:1ae:66cf:b90f with SMTP id u16-20020a170902e5d000b001ae66cfb90fmr57873plf.66.1684351686212; Wed, 17 May 2023 12:28:06 -0700 (PDT) Received: from localhost.localdomain ([111.201.128.95]) by smtp.gmail.com with ESMTPSA id jo13-20020a170903054d00b001a641e4738asm18005630plb.1.2023.05.17.12.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 12:28:05 -0700 (PDT) From: Yeqi Fu To: ulf.hansson@linaro.org, CLoehle@hyperstone.com, adrian.hunter@intel.com, avri.altman@wdc.com, axboe@kernel.dk Cc: Yeqi Fu , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Orlov Subject: [PATCH] mmc: core: Fix error checking Date: Thu, 18 May 2023 03:26:54 +0800 Message-Id: <20230517192654.367892-1-asuk4.q@gmail.com> X-Mailer: git-send-email 2.37.2 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 The functions debugfs_create_dir and debugfs_create_file_unsafe return ERR_PTR if an error occurs, and the appropriate way to verify for errors is to use the inline function IS_ERR. The patch will substitute the null-comparison with IS_ERR. Suggested-by: Ivan Orlov Signed-off-by: Yeqi Fu --- drivers/mmc/core/block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 00c33edb9fb9..507bebc22636 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2908,7 +2908,7 @@ static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) debugfs_create_file_unsafe("status", 0400, root, card, &mmc_dbg_card_status_fops); - if (!md->status_dentry) + if (IS_ERR(md->status_dentry)) return -EIO; } @@ -2916,7 +2916,7 @@ static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md) md->ext_csd_dentry = debugfs_create_file("ext_csd", S_IRUSR, root, card, &mmc_dbg_ext_csd_fops); - if (!md->ext_csd_dentry) + if (IS_ERR(md->ext_csd_dentry)) return -EIO; } -- 2.37.2