From patchwork Thu Aug 17 01:49:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: lizetao X-Patchwork-Id: 13355878 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB76CC41513 for ; Thu, 17 Aug 2023 01:51:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347477AbjHQBu3 (ORCPT ); Wed, 16 Aug 2023 21:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347599AbjHQBuS (ORCPT ); Wed, 16 Aug 2023 21:50:18 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3692BF; Wed, 16 Aug 2023 18:50:16 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RR7CR0Gy9zNmhd; Thu, 17 Aug 2023 09:46:43 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Thu, 17 Aug 2023 09:50:14 +0800 From: Li Zetao To: CC: , , Subject: [PATCH -next] scsi: target: core: Use helper function IS_ERR_OR_NULL() Date: Thu, 17 Aug 2023 09:49:58 +0800 Message-ID: <20230817014958.3094614-1-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org Use IS_ERR_OR_NULL() to detect an error pointer or a null pointer open-coding to simplify the code. Signed-off-by: Li Zetao --- drivers/target/target_core_fabric_configfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index b7c637644cd4..4b93f9b619b8 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c @@ -479,7 +479,7 @@ static struct config_group *target_fabric_make_np( } se_tpg_np = tf->tf_ops->fabric_make_np(se_tpg, group, name); - if (!se_tpg_np || IS_ERR(se_tpg_np)) + if (IS_ERR_OR_NULL(se_tpg_np)) return ERR_PTR(-EINVAL); se_tpg_np->tpg_np_parent = se_tpg; @@ -937,7 +937,7 @@ static struct config_group *target_fabric_make_tpg( } se_tpg = tf->tf_ops->fabric_make_tpg(wwn, name); - if (!se_tpg || IS_ERR(se_tpg)) + if (IS_ERR_OR_NULL(se_tpg)) return ERR_PTR(-EINVAL); config_group_init_type_name(&se_tpg->tpg_group, name, @@ -1088,7 +1088,7 @@ static struct config_group *target_fabric_make_wwn( } wwn = tf->tf_ops->fabric_make_wwn(tf, group, name); - if (!wwn || IS_ERR(wwn)) + if (IS_ERR_OR_NULL(wwn)) return ERR_PTR(-EINVAL); wwn->cmd_compl_affinity = SE_COMPL_AFFINITY_CPUID;