mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-06 13:02:18 +00:00
nvme: Fix the correct handling of a plain version number
This commit is contained in:
parent
c73c02fa70
commit
1fb8202b06
@ -206,14 +206,16 @@ fu_nvme_device_parse_cns_maybe_dell (FuNvmeDevice *self, const guint8 *buf)
|
|||||||
static gboolean
|
static gboolean
|
||||||
fu_nvme_device_set_version (FuNvmeDevice *self, const gchar *version, GError **error)
|
fu_nvme_device_set_version (FuNvmeDevice *self, const gchar *version, GError **error)
|
||||||
{
|
{
|
||||||
|
FuVersionFormat fmt = fu_device_get_version_format (FU_DEVICE (self));
|
||||||
|
|
||||||
/* unset */
|
/* unset */
|
||||||
if (fu_device_get_version_format (FU_DEVICE (self)) == FU_VERSION_FORMAT_UNKNOWN) {
|
if (fmt == FU_VERSION_FORMAT_UNKNOWN || fmt == FU_VERSION_FORMAT_PLAIN) {
|
||||||
fu_device_set_version (FU_DEVICE (self), version);
|
fu_device_set_version (FU_DEVICE (self), version);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AA.BB.CC.DD */
|
/* AA.BB.CC.DD */
|
||||||
if (fu_device_get_version_format (FU_DEVICE (self)) == FU_VERSION_FORMAT_QUAD) {
|
if (fmt == FU_VERSION_FORMAT_QUAD) {
|
||||||
guint64 tmp = g_ascii_strtoull (version, NULL, 16);
|
guint64 tmp = g_ascii_strtoull (version, NULL, 16);
|
||||||
g_autofree gchar *version_new = NULL;
|
g_autofree gchar *version_new = NULL;
|
||||||
if (tmp == 0 || tmp > G_MAXUINT32) {
|
if (tmp == 0 || tmp > G_MAXUINT32) {
|
||||||
@ -230,10 +232,11 @@ fu_nvme_device_set_version (FuNvmeDevice *self, const gchar *version, GError **e
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* invalid, or not supported */
|
/* invalid, or not supported */
|
||||||
g_set_error_literal (error,
|
g_set_error (error,
|
||||||
G_IO_ERROR,
|
G_IO_ERROR,
|
||||||
G_IO_ERROR_INVALID_DATA,
|
G_IO_ERROR_INVALID_DATA,
|
||||||
"version format not recognised");
|
"version format %s not handled",
|
||||||
|
fu_common_version_format_to_string (fmt));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user