serial: stm32: Fix warnings when compiling with W=1
authorPatrick Delaunay <patrick.delaunay@st.com>
Fri, 21 Jun 2019 13:26:41 +0000 (15:26 +0200)
committerPatrick Delaunay <patrick.delaunay@st.com>
Fri, 12 Jul 2019 09:50:54 +0000 (11:50 +0200)
This patch solves the following warnings:

drivers/serial/serial_stm32.c: In function 'stm32_serial_probe':
warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
  if (plat->clock_rate < 0) {
                       ^

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
drivers/serial/serial_stm32.c

index cca8b707acc42c8d3d10486a4a359940cdbba290..3ab536a52ac032c270b3d341c1ca2554d1ecbe8d 100644 (file)
@@ -195,9 +195,9 @@ static int stm32_serial_probe(struct udevice *dev)
        }
 
        plat->clock_rate = clk_get_rate(&clk);
-       if (plat->clock_rate < 0) {
+       if (!plat->clock_rate) {
                clk_disable(&clk);
-               return plat->clock_rate;
+               return -EINVAL;
        };
 
        _stm32_serial_init(plat->base, plat->uart_info);