Skip to content

Instantly share code, notes, and snippets.

@shinhirota
Last active September 7, 2015 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinhirota/6dff7cbbad182ab5face to your computer and use it in GitHub Desktop.
Save shinhirota/6dff7cbbad182ab5face to your computer and use it in GitHub Desktop.
int send_packet_to_device (void* packet) {
int ret;
ret = open_device();
if (ret != OK) {
printf("Device could not be opened!\n");
goto ERROR;
}
ret = send_packet(packet);
if (ret != OK) {
printf("Failed to send the packet!\n");
goto ERROR;
}
ret = close_device();
if (ret != OK) {
printf("Failed to close the device!\n");
goto ERROR;
}
return RET_OK;
ERROR:
printf("Some error happened!\n");
return RET_NG;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment