]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
dpaa2-eth: fix error return code in setup_dpni()
authorWei Yongjun <weiyongjun1@huawei.com>
Mon, 27 Apr 2020 10:43:22 +0000 (10:43 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 11:17:57 +0000 (13:17 +0200)
[ Upstream commit 97fff7c8de1e54e5326dfeb66085796864bceb64 ]

Fix to return negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c

index 7a248cc1055a306e96076a58a9fdef230c175651..7af7cc7c8669aa2cbf6e60db63662c18f63ee149 100644 (file)
@@ -2654,8 +2654,10 @@ static int setup_dpni(struct fsl_mc_device *ls_dev)
 
        priv->cls_rules = devm_kzalloc(dev, sizeof(struct dpaa2_eth_cls_rule) *
                                       dpaa2_eth_fs_count(priv), GFP_KERNEL);
-       if (!priv->cls_rules)
+       if (!priv->cls_rules) {
+               err = -ENOMEM;
                goto close;
+       }
 
        return 0;