diff --git a/compat/hidd.c b/compat/hidd.c index 88944cf28..2dae3a767 100644 --- a/compat/hidd.c +++ b/compat/hidd.c @@ -341,8 +341,7 @@ create: err = ioctl(ctl, HIDPCONNADD, &req); error: - if (req.rd_data) - free(req.rd_data); + free(req.rd_data); return err; } diff --git a/tools/bccmd.c b/tools/bccmd.c index 5cb925590..ca9302cbd 100644 --- a/tools/bccmd.c +++ b/tools/bccmd.c @@ -1226,8 +1226,7 @@ int main(int argc, char *argv[]) if (transport_open(transport, device, bcsp_rate) < 0) exit(1); - if (device) - free(device); + free(device); for (i = 0; commands[i].str; i++) { if (strcasecmp(commands[i].str, argv[0])) diff --git a/tools/hciattach_ath3k.c b/tools/hciattach_ath3k.c index 728e6605f..803cf464b 100644 --- a/tools/hciattach_ath3k.c +++ b/tools/hciattach_ath3k.c @@ -148,8 +148,8 @@ static int write_cmd(int fd, uint8_t *buffer, int len) return err; err = read_ps_event(event, HCI_PS_CMD_OCF); - if (event) - free(event); + + free(event); return err; } @@ -493,8 +493,7 @@ static int set_patch_ram(int dev, char *patch_loc, int len) err = read_ps_event(event, HCI_PS_CMD_OCF); - if (event) - free(event); + free(event); return err; } @@ -623,8 +622,7 @@ static int get_ath3k_crc(int dev) if (read_ps_event(event, HCI_PS_CMD_OCF) >= 0) err = -EILSEQ; - if (!event) - free(event); + free(event); return err; } @@ -667,8 +665,7 @@ static int get_device_type(int dev, uint32_t *code) *code = reg; cleanup: - if (event) - free(event); + free(event); return err; } @@ -709,8 +706,7 @@ static int read_ath3k_version(int pConfig, uint32_t *rom_version, *build_version = status; cleanup: - if (event) - free(event); + free(event); return err; } @@ -768,8 +764,7 @@ static int write_bdaddr(int pConfig, char *bdaddr) err = read_ps_event(event, HCI_PS_CMD_OCF); - if (event) - free(event); + free(event); return err; }