Skip to content

Commit 5aa4277

Browse files
IoanaCiorneidavem330
authored andcommitted
dpaa2-eth: free already allocated channels on probe defer
The setup_dpio() function tries to allocate a number of channels equal to the number of CPUs online. When there are not enough DPCON objects already probed, the function will return EPROBE_DEFER. When this happens, the already allocated channels are not freed. This results in the incapacity of properly probing the next time around. Fix this by freeing the channels on the error path. Fixes: d7f5a9d ("dpaa2-eth: defer probe on object allocate") Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6d6dd52 commit 5aa4277

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2232,8 +2232,16 @@ static int setup_dpio(struct dpaa2_eth_priv *priv)
22322232
err_service_reg:
22332233
free_channel(priv, channel);
22342234
err_alloc_ch:
2235-
if (err == -EPROBE_DEFER)
2235+
if (err == -EPROBE_DEFER) {
2236+
for (i = 0; i < priv->num_channels; i++) {
2237+
channel = priv->channel[i];
2238+
nctx = &channel->nctx;
2239+
dpaa2_io_service_deregister(channel->dpio, nctx, dev);
2240+
free_channel(priv, channel);
2241+
}
2242+
priv->num_channels = 0;
22362243
return err;
2244+
}
22372245

22382246
if (cpumask_empty(&priv->dpio_cpumask)) {
22392247
dev_err(dev, "No cpu with an affine DPIO/DPCON\n");

0 commit comments

Comments
 (0)