Hello, >> + for (i = 0; i < dev->caps.num_ports; i++) >> + kfree(dm[i]); >> goto out; >> } >> } >> -- >> 1.7.9.5 >> > >If you are going to change this, you might as well make it 100% correct: > >i—-; >while (i >= 0) > kfree(dm[i]); > >Then you don’t have to worry about whether kfree works on NULL, every item you >free will be guaranteed to be non-NULL. Thanks for suggestion :) Sent new patch with described changes, I was thinking one more thing.
In below code :- if (!ibdev->sriov.is_going_down) queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work); spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags); } out: kfree(dm); return; dm is freed after queue_work, is it correct to free dm when other dm[i] are allocated ? i did not get it. Thanks Maninder ------------