OSDN Git Service

counter: Return error code on invalid modes
authorWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Tue, 3 Aug 2021 12:06:12 +0000 (21:06 +0900)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 9 Aug 2021 19:17:36 +0000 (20:17 +0100)
commitb11eed1554e8ea33b748094ea73d8b42fa2bbe3b
tree9fef0018387c91f35cf29b9d8386da362814239f
parent728246e8f7269ecd35a2c6e6795323e6d8f48db7
counter: Return error code on invalid modes

Only a select set of modes (function, action, etc.) are valid for a
given device configuration. This patch ensures that invalid modes result
in a return -EINVAL. Such a situation should never occur in reality, but
it's good to define a default switch case for the sake of making the
intent of the code clear.

Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Acked-by: David Lechner <david@lechnology.com>
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/7af82d4e39610da11edce0ee370285fe1cb1eac8.1627990337.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/counter/104-quad-8.c
drivers/counter/microchip-tcb-capture.c
drivers/counter/stm32-lptimer-cnt.c
drivers/counter/ti-eqep.c