- for (i = 0; i < 3; i++) {
- if (!(ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE,
- channels[i]))) {
- sr_dbg("Channel malloc failed.");
- return NULL;
- }
- sdi->channels = g_slist_append(sdi->channels, ch);
- }
-
- if (!(devc = g_try_malloc(sizeof(struct dev_context)))) {
- sr_dbg("Device context malloc failed.");
- return NULL;
- }
+ for (i = 0; i < ARRAY_SIZE(channel_names); i++)
+ sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE,
+ channel_names[i]);
+ devc = g_malloc0(sizeof(struct dev_context));