On Wed, Mar 11, 2020 at 09:43:57AM +0100, Marco Felsch wrote:
Hi Sakari,
On 20-03-11 10:17, Sakari Ailus wrote:
quoted
Hi Marco,
On Mon, Mar 09, 2020 at 11:14:15AM +0100, Marco Felsch wrote:
...
quoted
+void v4l2_fwnode_connector_free(struct v4l2_fwnode_connector *connector)
+{
+ struct v4l2_connector_link *link, *tmp;
+
+ if (IS_ERR_OR_NULL(connector) ||
+ connector->type == V4L2_CONN_UNKNOWN)
+ return;
+
+ list_for_each_entry_safe(link, tmp, &connector->links, head) {
+ v4l2_fwnode_put_link(&link->fwnode_link);
+ list_del(&link->head);
+ kfree(link);
+ }
+
+ kfree(connector->label);
+ connector->label = NULL;
+ connector = NULL;
No need to set connector NULL here.
My intention was to make it safe e.g. if a caller calls this twice for
the same connector.
This changes the pointer to NULL locally but the caller won't see this ---
because it's the value of the pointer that was passed here by the caller.
--
Sakari Ailus