From 30e5ca534034992b8e815e099b462d50668e695c Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Fri, 4 Mar 2005 15:17:05 +0000 Subject: [PATCH] Minor changes: - Use FBSDID. - Remove an unused include. - Use auto-generated typedefs for the prototypes of the device interface functions. - Terminate the output of device_printf(9) with a newline char. - Honour the return value of malloc(3). MFC after: 1 month --- sys/sparc64/central/central.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/sparc64/central/central.c b/sys/sparc64/central/central.c index d26f9af55e08..3b0470475a13 100644 --- a/sys/sparc64/central/central.c +++ b/sys/sparc64/central/central.c @@ -22,10 +22,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -44,7 +45,6 @@ #include #include -#include struct central_devinfo { char *cdi_compat; @@ -60,12 +60,10 @@ struct central_softc { struct sbus_ranges *sc_ranges; }; -static int central_probe(device_t dev); -static int central_attach(device_t dev); - -static void central_probe_nomatch(device_t dev, device_t child); -static struct resource *central_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); +static device_probe_t central_probe; +static device_attach_t central_attach; +static bus_probe_nomatch_t central_probe_nomatch; +static bus_alloc_resource_t central_alloc_resource; static ofw_bus_get_compat_t central_get_compat; static ofw_bus_get_model_t central_get_model; static ofw_bus_get_name_t central_get_name; @@ -135,7 +133,7 @@ central_attach(device_t dev) sc->sc_nrange = OF_getprop_alloc(node, "ranges", sizeof(*sc->sc_ranges), (void **)&sc->sc_ranges); if (sc->sc_nrange == -1) { - device_printf(dev, "can't get ranges"); + device_printf(dev, "can't get ranges\n"); return (ENXIO); } @@ -144,8 +142,9 @@ central_attach(device_t dev) continue; cdev = device_add_child(dev, NULL, -1); if (cdev != NULL) { - cdi = malloc(sizeof(*cdi), M_DEVBUF, - M_WAITOK | M_ZERO); + cdi = malloc(sizeof(*cdi), M_DEVBUF, M_WAITOK | M_ZERO); + if (cdi == NULL) + continue; cdi->cdi_name = name; cdi->cdi_node = child; OF_getprop_alloc(child, "compatible", 1,