X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fopenbench-logic-sniffer%2Fprotocol.c;h=b732da59c19e5a271b553a9be7288186e6cb6530;hb=61f2b7f74cd2d05cacb2bfb3cad2c2d67c856f47;hp=c998c29524e1ce8b2c6b8014c42f1de09641121a;hpb=aac29cc192ccf82b64e77b5e6b11b411da32deed;p=libsigrok.git diff --git a/src/hardware/openbench-logic-sniffer/protocol.c b/src/hardware/openbench-logic-sniffer/protocol.c index c998c295..b732da59 100644 --- a/src/hardware/openbench-logic-sniffer/protocol.c +++ b/src/hardware/openbench-logic-sniffer/protocol.c @@ -124,10 +124,7 @@ SR_PRIV struct dev_context *ols_dev_new(void) { struct dev_context *devc; - if (!(devc = g_try_malloc(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - return NULL; - } + devc = g_malloc0(sizeof(struct dev_context)); /* Device-specific settings */ devc->max_samples = devc->max_samplerate = devc->protocol_version = 0; @@ -219,9 +216,8 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial) case 0x00: /* Number of usable channels */ for (ui = 0; ui < tmp_int; ui++) { - if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE, - ols_channel_names[ui]))) - return 0; + ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE, + ols_channel_names[ui]); sdi->channels = g_slist_append(sdi->channels, ch); } break; @@ -258,9 +254,8 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial) case 0x00: /* Number of usable channels */ for (ui = 0; ui < tmp_c; ui++) { - if (!(ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE, - ols_channel_names[ui]))) - return 0; + ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE, + ols_channel_names[ui]); sdi->channels = g_slist_append(sdi->channels, ch); } break;