Skip to contentSkip to conversation

counter: Add microchip TCB capture counter

bug report [email protected] 1 participant 1 message Jul 27, 2020 IIO

lore
Share & tools
lore
#0 lore raw

Hello Kamel Bouhara,

The patch 106b104137fd: "counter: Add microchip TCB capture counter" from Jul 6, 2020, leads to the following static checker warning:

drivers/counter/microchip-tcb-capture.c:188 mchp_tc_count_action_get()
warn: bitwise AND condition is false here

drivers/counter/microchip-tcb-capture.c
176 static int mchp_tc_count_action_get(struct counter_device *counter,

   177                                      struct counter_count *count,
   178                                      struct counter_synapse *synapse,
   179                                      size_t *action)

180 {
181 struct mchp_tc_data *const priv = counter->priv;
182 u32 cmr;
183
184 regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], CMR), &cmr);
185
186 *action = MCHP_TC_SYNAPSE_ACTION_NONE;
187
188 if (cmr & ATMEL_TC_ETRGEDG_NONE)

ATMEL_TC_ETRGEDG_NONE is zero so this condition is impossible.

   189                  *action = MCHP_TC_SYNAPSE_ACTION_NONE;
   190          else if (cmr & ATMEL_TC_ETRGEDG_RISING)
   191                  *action = MCHP_TC_SYNAPSE_ACTION_RISING_EDGE;
   192          else if (cmr & ATMEL_TC_ETRGEDG_FALLING)
   193                  *action = MCHP_TC_SYNAPSE_ACTION_FALLING_EDGE;
   194          else if (cmr & ATMEL_TC_ETRGEDG_BOTH)
   195                  *action = MCHP_TC_SYNAPSE_ACTION_BOTH_EDGE;
   196  
   197          return 0;
   198  }

regards,
dan carpenter