@@ -32,8 +32,6 @@
#include "btdev.h"
#include "serial.h"
-#define uninitialized_var(x) x = x
-
struct serial {
enum serial_type type;
uint16_t id;
@@ -147,7 +145,7 @@ again:
static void open_pty(struct serial *serial)
{
- enum btdev_type uninitialized_var(type);
+ enum btdev_type type;
serial->fd = posix_openpt(O_RDWR | O_NOCTTY);
if (serial->fd < 0) {
@@ -186,6 +184,9 @@ static void open_pty(struct serial *serial)
case SERIAL_TYPE_AMP:
type = BTDEV_TYPE_AMP;
break;
+ default:
+ printf("Unknown serial type %d\n", serial->type);
+ return;
}
serial->btdev = btdev_create(type, serial->id);
@@ -210,7 +211,6 @@ static void open_pty(struct serial *serial)
struct serial *serial_open(enum serial_type type)
{
struct serial *serial;
- enum btdev_type uninitialized_var(dev_type);
serial = malloc(sizeof(*serial));
if (!serial)
@@ -33,8 +33,6 @@
#include "btdev.h"
#include "server.h"
-#define uninitialized_var(x) x = x
-
struct server {
enum server_type type;
uint16_t id;
@@ -197,7 +195,7 @@ static void server_accept_callback(int fd, uint32_t
events, void *user_data)
{
struct server *server = user_data;
struct client *client;
- enum btdev_type uninitialized_var(type);
+ enum btdev_type type;
if (events & (EPOLLERR | EPOLLHUP)) {
mainloop_remove_fd(server->fd);
@@ -231,6 +229,11 @@ static void server_accept_callback(int fd, uint32_t
events, void *user_data)
break;
case SERVER_TYPE_MONITOR:
goto done;
+ default:
+ printf("Unknown btdev type %d\n", server->type);
+ close(client->fd);
+ free(client);
+ return;
}
client->btdev = btdev_create(type, server->id);
@@ -29,8 +29,6 @@
#include "btdev.h"
#include "vhci.h"
-#define uninitialized_var(x) x = x
-
struct vhci {
enum vhci_type type;
int fd;
@@ -85,8 +83,8 @@ static void vhci_read_callback(int fd, uint32_t
events, void *user_data)
struct vhci *vhci_open(enum vhci_type type)
{
struct vhci *vhci;
- enum btdev_type uninitialized_var(btdev_type);
- unsigned char uninitialized_var(ctrl_type);
+ enum btdev_type btdev_type;
+ unsigned char ctrl_type;
unsigned char setup_cmd[2];
static uint8_t id = 0x23;