git: 6bdc398832a6 - main - uart_dev_snps: Fix device probing

From: Kornel Dulęba <kd_at_FreeBSD.org>
Date: Thu, 06 Oct 2022 14:52:51 UTC
The branch main has been updated by kd:

URL: https://cgit.FreeBSD.org/src/commit/?id=6bdc398832a60f94a2d895f64b5546eec3af2da8

commit 6bdc398832a60f94a2d895f64b5546eec3af2da8
Author:     Kornel Dulęba <kd@FreeBSD.org>
AuthorDate: 2022-10-06 14:25:47 +0000
Commit:     Kornel Dulęba <kd@FreeBSD.org>
CommitDate: 2022-10-06 14:42:51 +0000

    uart_dev_snps: Fix device probing
    
    The "uart_bus_probe" function is used as a generic part of uart probe
    logic. It returns a driver priority(negative number) if successful and
    an error code otherwise.
    Fix the error checking condition to account for that.
    Also, while here return "BUS_PROBE_VENDOR", instead of "0".
    This fixes uart on clearfog pro with recent DT.
    
    PR:             266657
    Reviewed by:    mw
    Obtained from:  Semihalf
    Differential Revision: https://reviews.freebsd.org/D36880
---
 sys/dev/uart/uart_dev_snps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/uart/uart_dev_snps.c b/sys/dev/uart/uart_dev_snps.c
index b29fc48e5422..040f0ea00f0e 100644
--- a/sys/dev/uart/uart_dev_snps.c
+++ b/sys/dev/uart/uart_dev_snps.c
@@ -216,7 +216,7 @@ snps_probe(device_t dev)
 		device_printf(dev, "could not determine frequency\n");
 
 	error = uart_bus_probe(dev, (int)shift, (int)iowidth, (int)clock, 0, 0, UART_F_BUSY_DETECT);
-	if (error != 0)
+	if (error > 0)
 		return (error);
 
 	/* XXX uart_bus_probe has changed the softc, so refresh it */
@@ -227,7 +227,7 @@ snps_probe(device_t dev)
 	sc->apb_pclk = apb_pclk;
 	sc->reset = reset;
 
-	return (0);
+	return (BUS_PROBE_VENDOR);
 }
 
 static int