emmc: add check "name" sysattr is not NULL

At this point it has to be present, but better have the check for
correctness sake.
Follow up of
64fa633e30

Change-Id: I51b5995e25dc4dc4ec63b90af271cd90650d184d
This commit is contained in:
Daniil Lunev 2021-07-13 11:49:30 +10:00 committed by Mario Limonciello
parent 64fa633e30
commit 1ca9c92919

View File

@ -178,6 +178,14 @@ fu_emmc_device_probe (FuDevice *device, GError **error)
/* name */
tmp = g_udev_device_get_sysfs_attr (udev_parent, "name");
if (tmp == NULL) {
g_set_error (error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"%s does not have 'name' sysattr",
fu_device_get_name (device));
return FALSE;
}
fu_device_set_name (device, tmp);
name_only = g_strdup_printf ("EMMC\\%s", fu_device_get_name (device));
fu_device_add_instance_id (device, name_only);