On 01/07/20 15:06, Alexander Bulekov wrote:
>> Yes; you can also add it in pc_pflash_create, because
>>
>>     /*
>>      * Since object_property_add_child added a reference to the child object,
>>      * we can drop the reference added by object_initialize(), so the child
>>      * property will own the only reference to the object.
>>      */
>>
>> (from object_initialize_childv).
> Isn't that reference used at pc_sysfw.c:104 ?
> pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", "pflash0");
> 
> In this case, shouldn't we unref when
> pc_sysfw.c:126  pcms->flash[0] = NULL
> ?

object_unparent already drops a reference.  Therefore, it's okay to drop
the reference immediately after object_property_add_child (which adds a
reference) and match pc_pflash_create with just object_unparent.

Paolo


Reply via email to