Re: [PATCH v9 2/2] usb: cdns3: Add CIX Sky1 glue driver
From: Hongliang Yang
Date: Tue Nov 17 2026 - 20:44:48 EST
Both halves are real.
> Can this leak cdns_sky1_pdata and silently succeed when creating the child
> device fails?
Yes. With matches == NULL of_platform_populate() always returns 0:
of_platform_bus_create() returns 0 as soon as
of_platform_device_create_pdata() returns NULL. That function also returns
before it stores platform_data when the node is unavailable, when
OF_POPULATED is set, or when of_device_alloc() fails, and only the
of_device_add() failure path frees the buffer, through
platform_device_release(). With the child checked by
cdnsp_sky1_check_children(), the reachable cases are the two -ENOMEM ones.
v10 checks the result instead of the return value:
core = of_find_device_by_node(core_np);
if (!core) {
dev_err(dev, "failed to create the cdns3 child device\n");
ret = -ENODEV;
goto err_quiesce;
}
probe fails rather than returning 0 with the clocks and the resets still
active, and the buffer is freed where of_platform_populate() itself returns
an error.
The one case the caller cannot see is of_device_add() failing after the
buffer was handed over: it returns NULL like the of_device_alloc() failure
and has already freed the buffer. The two are indistinguishable, so the
buffer is left alone there - a one-off 16-byte leak under OOM rather than a
double free.