]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net: stmmac: fix errno when create_singlethread_workqueue() fails
authorGaosheng Cui <cuigaosheng1@huawei.com>
Wed, 14 Dec 2022 08:01:17 +0000 (16:01 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 15 Dec 2022 13:00:34 +0000 (14:00 +0100)
We should set the return value to -ENOMEM explicitly when
create_singlethread_workqueue() fails in stmmac_dvr_probe(),
otherwise we'll lose the error value.

Fixes: a137f3f27f92 ("net: stmmac: fix possible memory leak in stmmac_dvr_probe()")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20221214080117.3514615-1-cuigaosheng1@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index ec64b65dee34f6f44f850ff4e4c2588ec53ee450..c6951c976f5ddb2b67dc760bbb433c871c3efab4 100644 (file)
@@ -7099,6 +7099,7 @@ int stmmac_dvr_probe(struct device *device,
        priv->wq = create_singlethread_workqueue("stmmac_wq");
        if (!priv->wq) {
                dev_err(priv->device, "failed to create workqueue\n");
+               ret = -ENOMEM;
                goto error_wq_init;
        }