mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-07 17:45:23 +00:00
libdfu: Fix up some NULL/FALSE confusion
This commit is contained in:
parent
b3849683b6
commit
bd046c8a19
@ -481,8 +481,8 @@ dfu_context_get_device_by_vid_pid (DfuContext *context,
|
|||||||
GUsbDevice *dev;
|
GUsbDevice *dev;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_val_if_fail (DFU_IS_CONTEXT (context), FALSE);
|
g_return_val_if_fail (DFU_IS_CONTEXT (context), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
/* search all devices */
|
/* search all devices */
|
||||||
for (i = 0; i < priv->devices->len; i++) {
|
for (i = 0; i < priv->devices->len; i++) {
|
||||||
@ -536,8 +536,8 @@ dfu_context_get_device_by_platform_id (DfuContext *context,
|
|||||||
DfuContextItem *item;
|
DfuContextItem *item;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
g_return_val_if_fail (DFU_IS_CONTEXT (context), FALSE);
|
g_return_val_if_fail (DFU_IS_CONTEXT (context), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
/* search all devices */
|
/* search all devices */
|
||||||
for (i = 0; i < priv->devices->len; i++) {
|
for (i = 0; i < priv->devices->len; i++) {
|
||||||
@ -573,8 +573,8 @@ dfu_context_get_device_default (DfuContext *context, GError **error)
|
|||||||
DfuContextPrivate *priv = GET_PRIVATE (context);
|
DfuContextPrivate *priv = GET_PRIVATE (context);
|
||||||
DfuContextItem *item;
|
DfuContextItem *item;
|
||||||
|
|
||||||
g_return_val_if_fail (DFU_IS_CONTEXT (context), FALSE);
|
g_return_val_if_fail (DFU_IS_CONTEXT (context), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
/* none */
|
/* none */
|
||||||
if (priv->devices->len == 0) {
|
if (priv->devices->len == 0) {
|
||||||
|
@ -1700,7 +1700,7 @@ dfu_device_upload (DfuDevice *device,
|
|||||||
DFU_ERROR,
|
DFU_ERROR,
|
||||||
DFU_ERROR_NOT_SUPPORTED,
|
DFU_ERROR_NOT_SUPPORTED,
|
||||||
"device is not in DFU mode");
|
"device is not in DFU mode");
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
g_debug ("detaching");
|
g_debug ("detaching");
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ dfu_firmware_write_data_ihex (DfuFirmware *firmware, GError **error)
|
|||||||
if (!dfu_firmware_write_data_ihex_element (element,
|
if (!dfu_firmware_write_data_ihex_element (element,
|
||||||
str,
|
str,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ dfu_target_upload_chunk (DfuTarget *target, guint8 index,
|
|||||||
/* for ST devices, the action only occurs when we do GetStatus */
|
/* for ST devices, the action only occurs when we do GetStatus */
|
||||||
if (!dfu_device_has_quirk (priv->device, DFU_DEVICE_QUIRK_NO_GET_STATUS_UPLOAD)) {
|
if (!dfu_device_has_quirk (priv->device, DFU_DEVICE_QUIRK_NO_GET_STATUS_UPLOAD)) {
|
||||||
if (!dfu_target_check_status (target, cancellable, error))
|
if (!dfu_target_check_status (target, cancellable, error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_bytes_new_take (buf, actual_length);
|
return g_bytes_new_take (buf, actual_length);
|
||||||
@ -970,7 +970,7 @@ dfu_target_upload_element (DfuTarget *target,
|
|||||||
DFU_ERROR_INVALID_DEVICE,
|
DFU_ERROR_INVALID_DEVICE,
|
||||||
"no memory sector at 0x%04x",
|
"no memory sector at 0x%04x",
|
||||||
(guint) offset);
|
(guint) offset);
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!dfu_sector_has_cap (sector, DFU_SECTOR_CAP_READABLE)) {
|
if (!dfu_sector_has_cap (sector, DFU_SECTOR_CAP_READABLE)) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
@ -978,7 +978,7 @@ dfu_target_upload_element (DfuTarget *target,
|
|||||||
DFU_ERROR_INVALID_DEVICE,
|
DFU_ERROR_INVALID_DEVICE,
|
||||||
"memory sector at 0x%04x is not readble",
|
"memory sector at 0x%04x is not readble",
|
||||||
(guint) offset);
|
(guint) offset);
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* manually set the sector address */
|
/* manually set the sector address */
|
||||||
@ -988,7 +988,7 @@ dfu_target_upload_element (DfuTarget *target,
|
|||||||
offset,
|
offset,
|
||||||
cancellable,
|
cancellable,
|
||||||
error))
|
error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
last_sector_id = dfu_sector_get_id (sector);
|
last_sector_id = dfu_sector_get_id (sector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1533,7 +1533,7 @@ dfu_target_get_alt_name (DfuTarget *target, GError **error)
|
|||||||
DFU_ERROR,
|
DFU_ERROR,
|
||||||
DFU_ERROR_NOT_FOUND,
|
DFU_ERROR_NOT_FOUND,
|
||||||
"no alt-name");
|
"no alt-name");
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return priv->alt_name;
|
return priv->alt_name;
|
||||||
|
Loading…
Reference in New Issue
Block a user