fd = open (can_path, O_RDWR);
if (fd == -1) {
FRESCAN_ERROR ("could not open /dev/can%u\n", params->net);
+ FRESCAN_ERROR ("hint: check driver or card installation\n");
return -1;
}
DEBUG(FRESCAN_RX_HOOK_ENABLE_DEBUG || FRESCAN_FRAG_ENABLE_DEBUG,
"prio:%u dest:%u src:%u chan:%u id:%u flag:%u\n",
prio, dest, src, channel, frag_id, frag_flag);
-
DEBUG(FRESCAN_RX_HOOK_ENABLE_DEBUG,
"enqueue the packet in ID queue\n");
+
packet = frescan_packets_alloc();
+ if (packet == NULL) {
+ FRESCAN_ERROR("could not allocate packet\n");
+ return -1;
+ }
+
packet->frame = frame;
if (frag_id == FRESCAN_MX_IDS) {
FRESCAN_FRAG_ENABLE_DEBUG,
"allocate head for id=%u\n", frag_id);
head = frescan_packets_alloc();
+ if (head == NULL) {
+ FRESCAN_ERROR("could not allocate packet\n");
+ return -1;
+ }
+
INIT_LIST_HEAD(&head->msg_list);
if (frag_id == FRESCAN_MX_IDS) {
"Initializing FRESCAN FNA node%u\n", init_params.node);
ret = frescan_init(&init_params);
- if (ret != 0) FRESCAN_ERROR ("could not init FRESCAN");
+ if (ret != 0) {
+ FRESCAN_ERROR ("could not init FRESCAN\n");
+ return ret;
+ }
DEBUG(FRESCAN_BWRES_FNA_ENABLE_DEBUG, "Initializing BWRES\n");
ret = frescan_bwres_init(init_params.net);
- if (ret != 0) FRESCAN_ERROR ("could not init BWRES");
+ if (ret != 0) {
+ FRESCAN_ERROR ("could not init BWRES\n");
+ return ret;
+ }
return 0;
}
* DEBUG macros
**/
-#define DEBUG(enable,x,args...) if(enable) printc("DEBUG (%s): " x, __func__ , ##args)
-#define FRESCAN_ERROR(x,args...) {printe("ERROR (%s:%u): " x, __func__ , __LINE__ , ##args); exit(-1);}
-#define FRESCAN_WARNING(x,args...) printe("WARNING (%s): " x, __func__ , ##args)
+#define DEBUG(enable,x,args...) \
+ if(enable) printc("DEBUG (%s): " x, __func__ , ##args)
+
+#define FRESCAN_ERROR(x,args...) \
+ printe("ERROR (%s:%u): " x, __func__ , __LINE__ , ##args)
+
+#define FRESCAN_WARNING(x,args...) \
+ printe("WARNING (%s): " x, __func__ , ##args)
/**
* DEBUGGING FLAGS to enable/disable debugging messages
pos = freelist_alloc(&the_packet_pool_freelist);
if (pos == -1) {
FRESCAN_ERROR("could not allocate packet\n");
+ FRESCAN_ERROR("hint: configure FRESCAN_MX_PACKETS\n");
return NULL;
}