Skip to content
Merged
1 change: 1 addition & 0 deletions arch/xtensa/core/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ void exit(int return_code)
LOG_ERR("exit(%d)", return_code);
k_panic();
#endif
CODE_UNREACHABLE;
}

#ifdef XT_SIMULATOR
Expand Down
1 change: 1 addition & 0 deletions cmake/compiler/clang/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set_compiler_property(PROPERTY warning_base
-Wformat-security
-Wno-format-zero-length
-Wno-main
-Wno-unused-but-set-variable
-Wno-typedef-redefinition
)

Expand Down
2 changes: 1 addition & 1 deletion drivers/flash/flash_ite_it8xxx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
LOG_MODULE_REGISTER(flash_ite_it8xxx2);

/* RAM code start address */
extern char _ram_code_start;
extern char _ram_code_start[];
#define FLASH_RAMCODE_START ((uint32_t)&_ram_code_start)
#define FLASH_RAMCODE_START_BIT19 BIT(19)
/* RAM code section */
Expand Down
7 changes: 5 additions & 2 deletions drivers/sensor/adxl372/adxl372.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,16 +643,19 @@ static int adxl372_attr_set_thresh(const struct device *dev,
{
const struct adxl372_dev_config *cfg = dev->config;
struct adxl372_activity_threshold threshold;
int64_t llvalue;
int32_t value;
int64_t micro_ms2 = val->val1 * 1000000LL + val->val2;
uint8_t reg;

value = abs((micro_ms2 * 10) / SENSOR_G);
llvalue = llabs((micro_ms2 * 10) / SENSOR_G);

if (value > 2047) {
if (llvalue > 2047) {
return -EINVAL;
}

value = (int32_t) llvalue;

threshold.thresh = value;
threshold.enable = cfg->activity_th.enable;
threshold.referenced = cfg->activity_th.referenced;
Expand Down
13 changes: 8 additions & 5 deletions drivers/serial/uart_native_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,37 +129,39 @@ static int open_tty(struct native_uart_status *driver_data,
err_nbr = errno;
close(master_pty);
ERROR("Could not grant access to the slave PTY side (%i)\n",
errno);
err_nbr);
}
ret = unlockpt(master_pty);
if (ret == -1) {
err_nbr = errno;
close(master_pty);
ERROR("Could not unlock the slave PTY side (%i)\n", errno);
ERROR("Could not unlock the slave PTY side (%i)\n", err_nbr);
}
slave_pty_name = ptsname(master_pty);
if (slave_pty_name == NULL) {
err_nbr = errno;
close(master_pty);
ERROR("Error getting slave PTY device name (%i)\n", errno);
ERROR("Error getting slave PTY device name (%i)\n", err_nbr);
}
/* Set the master PTY as non blocking */
flags = fcntl(master_pty, F_GETFL);
if (flags == -1) {
err_nbr = errno;
close(master_pty);
ERROR("Could not read the master PTY file status flags (%i)\n",
errno);
err_nbr);
}

ret = fcntl(master_pty, F_SETFL, flags | O_NONBLOCK);
if (ret == -1) {
err_nbr = errno;
close(master_pty);
ERROR("Could not set the master PTY as non-blocking (%i)\n",
errno);
err_nbr);
}

(void) err_nbr;

/*
* Set terminal in "raw" mode:
* Not canonical (no line input)
Expand Down Expand Up @@ -291,6 +293,7 @@ static void np_uart_poll_out(const struct device *dev,
* but we do not need the return value for anything.
*/
ret = write(d->out_fd, &out_char, 1);
(void) ret;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions samples/subsys/logging/syst/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void log_msgs(void)
#endif
}

void main(void)
int main(void)
{
log_msgs();

Expand All @@ -140,5 +140,5 @@ void main(void)
/* raw string */
printk("SYST Sample Execution Completed\n");
#endif

return 0;
}
4 changes: 2 additions & 2 deletions subsys/usb/device/class/hid/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ void hid_sof_handler(struct hid_device_info *dev_data)
continue;
}

uint32_t diff = abs(dev_data->idle_rate[i] * 4U -
dev_data->sof_cnt[i]);
int32_t diff = abs((int32_t) ((uint32_t) dev_data->idle_rate[i] * 4U -
dev_data->sof_cnt[i]));

if (diff < 2 && reported == false) {
dev_data->sof_cnt[i] = 0U;
Expand Down
4 changes: 2 additions & 2 deletions tests/kernel/timer/timer_api/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct timer_data {
#define DURATION 100
#define PERIOD 50
#define EXPIRE_TIMES 4
#define WITHIN_ERROR(var, target, epsilon) (abs((target) - (var)) <= (epsilon))
#define WITHIN_ERROR(var, target, epsilon) (llabs((int64_t) ((target) - (var))) <= (epsilon))

/* ms can be converted precisely to ticks only when a ms is exactly
* represented by an integral number of ticks. If the conversion is
Expand Down Expand Up @@ -104,7 +104,7 @@ static bool interval_check(int64_t interval, int64_t desired)
slop += 2 * k_ticks_to_ms_ceil32(1);
}

if (abs(interval - desired) > slop) {
if (!WITHIN_ERROR(interval, desired, slop)) {
return false;
}

Expand Down
3 changes: 2 additions & 1 deletion tests/lib/newlib/heap_listener/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ static void heap_resized(uintptr_t heap_id, void *old_heap_end, void *new_heap_e

static HEAP_LISTENER_RESIZE_DEFINE(listener, HEAP_ID_LIBC, heap_resized);

void *ptr;

/**
* @brief Test that heap listener is notified when libc heap size changes.
*
Expand All @@ -45,7 +47,6 @@ static HEAP_LISTENER_RESIZE_DEFINE(listener, HEAP_ID_LIBC, heap_resized);
void test_alloc_and_trim(void)
{
uintptr_t saved_heap_end;
void *ptr;

TC_PRINT("Allocating memory...\n");

Expand Down