modem-manager: Fix a segfault on startup for some MBIM-QDU devices

Works around https://github.com/fwupd/fwupd/issues/4190 although we
still need to find the root cause.
This commit is contained in:
Richard Hughes 2022-01-19 10:11:10 +00:00
parent b728608baa
commit 4329ddbd76
2 changed files with 27 additions and 0 deletions

View File

@ -188,6 +188,15 @@ fu_firehose_validate_rawprogram(GBytes *rawprogram,
gboolean
fu_firehose_updater_open(FuFirehoseUpdater *self, GError **error)
{
/* sanity check */
if (self->port == NULL) {
g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"no firehose port provided for filename");
return FALSE;
}
g_debug("opening firehose port...");
self->io_channel = fu_io_channel_new_file(self->port, error);
return (self->io_channel != NULL);

View File

@ -551,6 +551,15 @@ fu_mm_device_probe(FuDevice *device, GError **error)
static gboolean
fu_mm_device_io_open_qcdm(FuMmDevice *self, GError **error)
{
/* sanity check */
if (self->port_qcdm == NULL) {
g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"no QCDM port provided for filename");
return FALSE;
}
/* open device */
self->io_channel = fu_io_channel_new_file(self->port_qcdm, error);
if (self->io_channel == NULL)
@ -695,6 +704,15 @@ fu_mm_device_at_cmd(FuMmDevice *self, const gchar *cmd, gboolean has_response, G
static gboolean
fu_mm_device_io_open(FuMmDevice *self, GError **error)
{
/* sanity check */
if (self->port_at == NULL) {
g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"no AT port provided for filename");
return FALSE;
}
/* open device */
self->io_channel = fu_io_channel_new_file(self->port_at, error);
if (self->io_channel == NULL)