From patchwork Wed Aug 28 12:23:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Li X-Patchwork-Id: 13781191 X-Patchwork-Delegate: kuba@kernel.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D03E166F36 for ; Wed, 28 Aug 2024 12:15:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724847339; cv=none; b=pW2xd6ardLiuY/g6kScTQalpW4XpLZRzDNFP8P9FAEX2bB747TTXQjzmlJjuZLSD84ahvnXgRYI6YGKYt//z8gI2/GdZYxjF47f9aJ36in2mVd3/h3KqOYrzP+SELmpmnchQYqZA81Y890AbahIsZ67Wiz9XuMJ6nU8bgU5U+J8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724847339; c=relaxed/simple; bh=NAAPPhaJgjSrve0VgHpOE23wP4KyroMAUTkEgXOXexk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=ty/iMZk2QMmgvw4vbvozJJNcd+VjuqVU6JgSy8K9hQeZH9eV2992warRcpe/ONhGVOUwrdHdESgs33NZzzEGhYT/2j3V5Dr89cnQNarkziog6TWEMd6tPk+SllRYDg+ELEk8XGPlnhHICB/+0rGVG9WasGmpz2yqgdcEhqQlGhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Wv3J64jh5zyQhm; Wed, 28 Aug 2024 20:14:46 +0800 (CST) Received: from dggpeml500022.china.huawei.com (unknown [7.185.36.66]) by mail.maildlp.com (Postfix) with ESMTPS id 3642F18007C; Wed, 28 Aug 2024 20:15:35 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 28 Aug 2024 20:15:34 +0800 From: Hongbo Li To: , , , , , CC: , Subject: [PATCH net-next] net: hns: Use IS_ERR_OR_NULL() helper function Date: Wed, 28 Aug 2024 20:23:36 +0800 Message-ID: <20240828122336.3697176-1-lihongbo22@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500022.china.huawei.com (7.185.36.66) X-Patchwork-Delegate: kuba@kernel.org Use the IS_ERR_OR_NULL() helper instead of open-coding a NULL and an error pointer checks to simplify the code and improve readability. Signed-off-by: Hongbo Li Reviewed-by: Jacob Keller --- drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c index f75668c47935..53e0da0bfbed 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c @@ -734,7 +734,7 @@ hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb, return -ENODATA; phy = get_phy_device(mdio, addr, is_c45); - if (!phy || IS_ERR(phy)) + if (IS_ERR_OR_NULL(phy)) return -EIO; phy->irq = mdio->irq[addr];