mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 14:22:13 +00:00
Revert "thunderbolt: add some guards around empty arrays"
This reverts commit 5f1c991c40
.
This commit is contained in:
parent
efa55b83a7
commit
10ec93b187
@ -80,13 +80,11 @@ static FuThunderboltInfo *
|
|||||||
fu_plugin_thunderbolt_get_info_by_id (FuPlugin *plugin, const gchar *id)
|
fu_plugin_thunderbolt_get_info_by_id (FuPlugin *plugin, const gchar *id)
|
||||||
{
|
{
|
||||||
FuPluginData *data = fu_plugin_get_data (plugin);
|
FuPluginData *data = fu_plugin_get_data (plugin);
|
||||||
if (data->infos) {
|
|
||||||
for (guint i = 0; i < data->infos->len; i++) {
|
for (guint i = 0; i < data->infos->len; i++) {
|
||||||
FuThunderboltInfo *info = g_ptr_array_index (data->infos, i);
|
FuThunderboltInfo *info = g_ptr_array_index (data->infos, i);
|
||||||
if (g_strcmp0 (info->id, id) == 0)
|
if (g_strcmp0 (info->id, id) == 0)
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,12 +113,10 @@ fu_plugin_thunderbolt_rescan (FuPlugin *plugin, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* no longer valid */
|
/* no longer valid */
|
||||||
if (data->infos) {
|
|
||||||
for (guint i = 0; i < data->infos->len; i++) {
|
for (guint i = 0; i < data->infos->len; i++) {
|
||||||
FuThunderboltInfo *info = g_ptr_array_index (data->infos, i);
|
FuThunderboltInfo *info = g_ptr_array_index (data->infos, i);
|
||||||
info->controller = NULL;
|
info->controller = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* go through each device in results */
|
/* go through each device in results */
|
||||||
for (guint i = 0; i < data->controllers_len; i++) {
|
for (guint i = 0; i < data->controllers_len; i++) {
|
||||||
@ -210,7 +206,6 @@ fu_plugin_thunderbolt_rescan (FuPlugin *plugin, GError **error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* any devices were removed */
|
/* any devices were removed */
|
||||||
if (data->infos) {
|
|
||||||
infos_remove = g_ptr_array_new ();
|
infos_remove = g_ptr_array_new ();
|
||||||
for (guint i = 0; i < data->infos->len; i++) {
|
for (guint i = 0; i < data->infos->len; i++) {
|
||||||
FuThunderboltInfo *info = g_ptr_array_index (data->infos, i);
|
FuThunderboltInfo *info = g_ptr_array_index (data->infos, i);
|
||||||
@ -223,7 +218,6 @@ fu_plugin_thunderbolt_rescan (FuPlugin *plugin, GError **error)
|
|||||||
FuThunderboltInfo *info = g_ptr_array_index (infos_remove, i);
|
FuThunderboltInfo *info = g_ptr_array_index (infos_remove, i);
|
||||||
g_ptr_array_remove (data->infos, info);
|
g_ptr_array_remove (data->infos, info);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -338,13 +332,11 @@ fu_plugin_thunderbolt_find_devpath (FuPlugin *plugin, GUdevDevice *udev_device)
|
|||||||
{
|
{
|
||||||
FuPluginData *data = fu_plugin_get_data (plugin);
|
FuPluginData *data = fu_plugin_get_data (plugin);
|
||||||
const gchar *devpath = g_udev_device_get_sysfs_path (udev_device);
|
const gchar *devpath = g_udev_device_get_sysfs_path (udev_device);
|
||||||
if (data->devpaths) {
|
|
||||||
for (guint i = 0; i < data->devpaths->len; i++) {
|
for (guint i = 0; i < data->devpaths->len; i++) {
|
||||||
const gchar *devpath_tmp = g_ptr_array_index (data->devpaths, i);
|
const gchar *devpath_tmp = g_ptr_array_index (data->devpaths, i);
|
||||||
if (g_strcmp0 (devpath_tmp, devpath) == 0)
|
if (g_strcmp0 (devpath_tmp, devpath) == 0)
|
||||||
return devpath_tmp;
|
return devpath_tmp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user