parent_net = batadv_getlink_net(net_dev, net);
  
+       /* iflink to itself, most likely physical device */
+       if (net == parent_net && iflink == net_dev->ifindex)
+               return false;
+ 
        /* recurse over the parent device */
-       parent_dev = __dev_get_by_index((struct net *)parent_net,
-                                       dev_get_iflink(net_dev));
+       parent_dev = __dev_get_by_index((struct net *)parent_net, iflink);
 -      /* if we got a NULL parent_dev there is something broken.. */
        if (!parent_dev) {
 -              pr_err("Cannot find parent device\n");
 +              pr_warn("Cannot find parent device. Skipping batadv-on-batadv check for %s\n",
 +                      net_dev->name);
                return false;
        }
  
 
        rc = tcp_register_ulp(&smc_ulp_ops);
        if (rc) {
                pr_err("%s: tcp_ulp_register fails with %d\n", __func__, rc);
-               goto out_sock;
+               goto out_ib;
        }
  
 +      rc = smc_sysctl_init();
 +      if (rc) {
 +              pr_err("%s: sysctl_init fails with %d\n", __func__, rc);
 +              goto out_ulp;
 +      }
 +
        static_branch_enable(&tcp_have_smc);
        return 0;
  
 +out_ulp:
 +      tcp_unregister_ulp(&smc_ulp_ops);
+ out_ib:
+       smc_ib_unregister_client();
  out_sock:
        sock_unregister(PF_SMC);
  out_proto6: