linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] counter: Add microchip TCB capture counter
@ 2020-07-27  9:37 dan.carpenter
  0 siblings, 0 replies; only message in thread
From: dan.carpenter @ 2020-07-27  9:37 UTC (permalink / raw)
  To: kamel.bouhara; +Cc: linux-iio

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-27  9:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27  9:37 [bug report] counter: Add microchip TCB capture counter dan.carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).