> The deference occurs in the non-IS_ERR() path. Here is the patched code:
>
> vah = ib_create_ah(pd, attr);
> if (IS_ERR(vah)) {
> kfree(ah);
> ah = (struct ipoib_ah *)vah;
> } else {
> ah->ah = vah; <------------------ defer w/o free
> ipoib_dbg(netdev_priv(dev), "Created ah %p\n", ah->ah);
> }
>
> I agree that perhaps the code should just return a cast of vah in the IS_ERR()
> case so it's clearer?
Thanks for clarifying. I misread the patch. The resulting function looks
clear enough with everything together.