master/canopen.c
changeset 484 9fde4a17b820
parent 448 e4b76dc7910c
child 646 fbbd4e54e031
equal deleted inserted replaced
483:1a507e9ab735 484:9fde4a17b820
   120     kobject_init(&sdo->kobj);
   120     kobject_init(&sdo->kobj);
   121     sdo->kobj.ktype = &ktype_ec_sdo;
   121     sdo->kobj.ktype = &ktype_ec_sdo;
   122     sdo->kobj.parent = &slave->sdo_kobj;
   122     sdo->kobj.parent = &slave->sdo_kobj;
   123     if (kobject_set_name(&sdo->kobj, "%4X", sdo->index)) {
   123     if (kobject_set_name(&sdo->kobj, "%4X", sdo->index)) {
   124         EC_ERR("Failed to set kobj name.\n");
   124         EC_ERR("Failed to set kobj name.\n");
       
   125         kobject_put(&sdo->kobj);
       
   126         return -1;
       
   127     }
       
   128     if (kobject_add(&sdo->kobj)) {
       
   129         EC_ERR("Failed to add SDO kobject.\n");
       
   130         kobject_put(&sdo->kobj);
   125         return -1;
   131         return -1;
   126     }
   132     }
   127 
   133 
   128     return 0;
   134     return 0;
   129 }
   135 }
   220     kobject_init(&entry->kobj);
   226     kobject_init(&entry->kobj);
   221     entry->kobj.ktype = &ktype_ec_sdo_entry;
   227     entry->kobj.ktype = &ktype_ec_sdo_entry;
   222     entry->kobj.parent = &sdo->kobj;
   228     entry->kobj.parent = &sdo->kobj;
   223     if (kobject_set_name(&entry->kobj, "%i", entry->subindex)) {
   229     if (kobject_set_name(&entry->kobj, "%i", entry->subindex)) {
   224         EC_ERR("Failed to set kobj name.\n");
   230         EC_ERR("Failed to set kobj name.\n");
       
   231         kobject_put(&entry->kobj);
       
   232         return -1;
       
   233     }
       
   234     if (kobject_add(&entry->kobj)) {
       
   235         EC_ERR("Failed to add entry kobject.\n");
       
   236         kobject_put(&entry->kobj);
   225         return -1;
   237         return -1;
   226     }
   238     }
   227 
   239 
   228     return 0;
   240     return 0;
   229 }
   241 }