From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1423C27C7A for ; Thu, 17 Aug 2023 09:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=76oSUKWC0FwBsoam1/cxqkp1jwqWDOMVJw5/YMyN1/U=; b=qGCTT5jE7asMTx Rub/yWf0K9tET8qPPlW5f4UuiH2tYZ/vuOSxyib7L84x5N8pU052gjRwCgSmpezEtWr/lUKhFKl0g pvP9vwtVIEHkQeu8LjBuceBysE+GImiEGyJJuSlOZ9XDimjhLIqZx3bT6DbbhjlrVvp89ruITUCU4 OIToPkpUUPMOgc8ymxk0dLNxTvHYImg49qbocC9vvlI8VhYvAKDE/mgDkd3Y6jzf1WaUVKFas73VP wlSpuP75x1YUUvWOUt+1NUNRsdxOqy4sPQGhKS1a82mgT2fXA9mwCMXotNBZM0b6P9pUkoHvxvq8i s0u6wh2anp+U53kgFCeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWZeC-005ycs-1n; Thu, 17 Aug 2023 09:50:32 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWZe9-005ybr-0x for linux-arm-kernel@lists.infradead.org; Thu, 17 Aug 2023 09:50:30 +0000 Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RRKvm1pyTzrRgx; Thu, 17 Aug 2023 17:48:52 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by kwepemi500008.china.huawei.com (7.221.188.139) 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 17:50:13 +0800 Message-ID: <5a885cda-4ee3-6c26-e6ea-5074427e974b@huawei.com> Date: Thu, 17 Aug 2023 17:50:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH net-next 0/2] net: Use helper function IS_ERR_OR_NULL() Content-Language: en-US To: Leon Romanovsky CC: , , , , , , , , , , , , , , References: <20230817071941.346590-1-ruanjinjie@huawei.com> <20230817080257.GD22185@unreal> From: Ruan Jinjie In-Reply-To: <20230817080257.GD22185@unreal> X-Originating-IP: [10.67.109.254] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230817_025029_576772_23882A55 X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2023/8/17 16:02, Leon Romanovsky wrote: > On Thu, Aug 17, 2023 at 03:19:39PM +0800, Ruan Jinjie wrote: >> Use IS_ERR_OR_NULL() instead of open-coding it >> to simplify the code. >> >> Ruan Jinjie (2): >> net: microchip: sparx5: Use helper function IS_ERR_OR_NULL() >> net: stmmac: Use helper function IS_ERR_OR_NULL() >> >> drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 2 +- >> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> > > Thanks, > Reviewed-by: Leon Romanovsky > > As a side note, grep of vcap_get_rule() shows that many callers don't > properly check return value and expect it to be or valid or NULL. Right! I will try to fix these problems together by the way. Thank you! > > For example this code is not correct: > drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c > 61 vrule = vcap_get_rule(lan966x->vcap_ctrl, rule_id); > 62 if (vrule) { > 63 u32 value, mask; > 64 > 65 /* Just modify the ingress port mask and exit */ > 66 vcap_rule_get_key_u32(vrule, VCAP_KF_IF_IGR_PORT_MASK, > 67 &value, &mask); > 68 mask &= ~BIT(port->chip_port); > 69 vcap_rule_mod_key_u32(vrule, VCAP_KF_IF_IGR_PORT_MASK, > 70 value, mask); > 71 > 72 err = vcap_mod_rule(vrule); > 73 goto free_rule; > 74 } > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel