drivers: Add 'U' to unsigned variable assignments

Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
Patrik Flykt 2018-11-29 11:12:22 -08:00 committed by Anas Nashif
commit 8ff96b5a57
172 changed files with 693 additions and 693 deletions

View file

@ -259,11 +259,11 @@ static int i2s_cavs_configure(struct device *dev, enum i2s_dir dir,
u32_t sstsa;
u32_t ssrsa;
u32_t ssto;
u32_t ssioc = 0;
u32_t ssioc = 0U;
u32_t mdiv;
u32_t i2s_m = 0;
u32_t i2s_n = 0;
u32_t frame_len = 0;
u32_t i2s_m = 0U;
u32_t i2s_n = 0U;
u32_t frame_len = 0U;
bool inverted_frame = false;
if ((dev_data->tx.state != I2S_STATE_NOT_READY) &&
@ -308,14 +308,14 @@ static int i2s_cavs_configure(struct device *dev, enum i2s_dir dir,
ssc1 = SSCR1_TTE | SSCR1_TTELP | SSCR1_TRAIL | SSCR1_TSRE | SSCR1_RSRE;
/* sscr2 dynamic setting is LJDFD */
ssc2 = 0;
ssc2 = 0U;
/* sscr3 dynamic settings are TFT, RFT */
ssc3 = SSCR3_TX(CAVS_I2S_DMA_BURST_SIZE) |
SSCR3_RX(CAVS_I2S_DMA_BURST_SIZE);
/* sspsp dynamic settings are SCMODE, SFRMP, DMYSTRT, SFRMWDTH */
sspsp = 0;
sspsp = 0U;
/* sspsp2 no dynamic setting */
sspsp2 = 0x0;
@ -384,7 +384,7 @@ static int i2s_cavs_configure(struct device *dev, enum i2s_dir dir,
i2s_n = mclk / 100;
/* set divider value of 1 which divides the clock by 2 */
mdiv = 1;
mdiv = 1U;
/* Select M/N divider as the clock source */
ssc0 |= SSCR0_ECS;

View file

@ -775,7 +775,7 @@ static void tx_queue_drop(struct stream *stream)
{
size_t size;
void *mem_block;
unsigned int n = 0;
unsigned int n = 0U;
while (queue_get(&stream->mem_block_queue, &mem_block, &size) == 0) {
k_mem_slab_free(stream->cfg.mem_slab, &mem_block);

View file

@ -310,15 +310,15 @@ static int set_rx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
const bool pin_rf_en = IS_ENABLED(CONFIG_I2S_SAM_SSC_0_PIN_RF_EN);
u8_t word_size_bits = i2s_cfg->word_size;
u8_t num_words = i2s_cfg->channels;
u8_t fslen = 0;
u32_t ssc_rcmr = 0;
u32_t ssc_rfmr = 0;
u8_t fslen = 0U;
u32_t ssc_rcmr = 0U;
u32_t ssc_rfmr = 0U;
bool frame_clk_master = !(i2s_cfg->options & I2S_OPT_FRAME_CLK_SLAVE);
switch (i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) {
case I2S_FMT_DATA_FORMAT_I2S:
num_words = 2;
num_words = 2U;
fslen = word_size_bits - 1;
ssc_rcmr = SSC_RCMR_CKI
@ -401,14 +401,14 @@ static int set_tx_data_format(const struct i2s_sam_dev_cfg *const dev_cfg,
Ssc *const ssc = dev_cfg->regs;
u8_t word_size_bits = i2s_cfg->word_size;
u8_t num_words = i2s_cfg->channels;
u8_t fslen = 0;
u32_t ssc_tcmr = 0;
u32_t ssc_tfmr = 0;
u8_t fslen = 0U;
u32_t ssc_tcmr = 0U;
u32_t ssc_tfmr = 0U;
switch (i2s_cfg->format & I2S_FMT_DATA_FORMAT_MASK) {
case I2S_FMT_DATA_FORMAT_I2S:
num_words = 2;
num_words = 2U;
fslen = word_size_bits - 1;
ssc_tcmr = SSC_TCMR_START_TF_FALLING
@ -729,7 +729,7 @@ static void tx_queue_drop(struct stream *stream)
{
size_t size;
void *mem_block;
unsigned int n = 0;
unsigned int n = 0U;
while (queue_get(&stream->mem_block_queue, &mem_block, &size) == 0) {
k_mem_slab_free(stream->cfg.mem_slab, &mem_block);