void *devlink_priv(struct devlink *devlink)  {
+       if (devlink->is_shd)
+               return devlink_shd_get_priv(devlink);
I'm afraid it can cause recursion, if you didn't modify the function:

right, thanks
I should have really send this as an RFC :/

void *devlink_shd_get_priv(struct devlink *devlink)
{
     struct devlink_shd *shd = devlink_priv(devlink);

+
        return &devlink->priv;
  }

...

        if (refcount_dec_and_test(&shd->refcount))
                devlink_shd_destroy(shd);
        mutex_unlock(&shd_mutex);
@@ -159,4 +165,3 @@ void *devlink_shd_get_priv(struct devlink
*devlink)

        return shd->priv;
  }
-EXPORT_SYMBOL_GPL(devlink_shd_get_priv);
--
2.39.3


Reply via email to