X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fpipistrello-ols%2Fprotocol.c;h=272c8a8c3baa6f34206a9552cb12b3146de00f58;hb=61f2b7f74cd2d05cacb2bfb3cad2c2d67c856f47;hp=81bbe8e647fe02e09f9b45716e1a0896adcd8c7f;hpb=0af636bed97c174bea46e61e961eaa1b0b162e0f;p=libsigrok.git diff --git a/src/hardware/pipistrello-ols/protocol.c b/src/hardware/pipistrello-ols/protocol.c index 81bbe8e6..272c8a8c 100644 --- a/src/hardware/pipistrello-ols/protocol.c +++ b/src/hardware/pipistrello-ols/protocol.c @@ -226,7 +226,7 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str guchar tmp_c; int index, i; - sdi = sr_dev_inst_new(); + sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->driver = di; sdi->priv = devc; @@ -289,9 +289,8 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str case 0x00: /* Number of usable channels */ for (ui = 0; ui < tmp_int; ui++) { - if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE, - p_ols_channel_names[ui]))) - return 0; + ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE, + p_ols_channel_names[ui]); sdi->channels = g_slist_append(sdi->channels, ch); } break; @@ -326,9 +325,8 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str case 0x00: /* Number of usable channels */ for (ui = 0; ui < tmp_c; ui++) { - if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE, - p_ols_channel_names[ui]))) - return 0; + ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE, + p_ols_channel_names[ui]); sdi->channels = g_slist_append(sdi->channels, ch); } break;