Don't leak work if __mlx4_register_vlan fails in mlx4_master_immediate_activate_vlan_qos
MFC after: 3 days
Submitted by: Miles Olrich <miles.olrich@isilon.com>
Sponsored by: EMC / Isilon Storage Division
Differential D4203
Don't leak `work` if `__mlx4_register_vlan` fails in `mlx4_master_immediate_activate_vlan_qos` Authored by ngie on Nov 19 2015, 12:49 AM. Tags None Referenced Files
Details
Don't leak work if __mlx4_register_vlan fails in mlx4_master_immediate_activate_vlan_qos MFC after: 3 days
Diff Detail
Event TimelineComment Actions Looks correct to me, but I'd suggest using an err goto label instead - that's how pretty much all the error-handling is done in the OFED code. Comment Actions work is usable in the positive case though. A few other spots in the code do the same thing (just return instead of goto'ing to a label): 932 if (!err) {
933 for (vidx = index * 32; vidx < (index + 1) * 32; ++vidx) {
934 pidx = priv->virt2phys_pkey[slave][port - 1][vidx];
935 outtab[vidx % 32] = cpu_to_be16(table[pidx]);
936 }
937 }
938 kfree(table);
939 return err;
940 }
...
1614 if (ret) {
1615 mlx4_err(dev, "%s:Failed reading vhcr"
1616 "ret: 0x%x\n", __func__, ret);
1617 kfree(vhcr);
1618 return ret;
1619 }
...
2405 if (!mailbox->buf) {
2406 kfree(mailbox);
2407 return ERR_PTR(-ENOMEM);
2408 }Comment Actions I'm suggesting having: return 0; err: kfree(work); return err; There are counterexamples, but this is the most common and best pattern. But it's not a big deal in this case. |