Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/luna68k/dev Misc KNF and cosmetics.



details:   https://anonhg.NetBSD.org/src/rev/3ec061a154f2
branches:  trunk
changeset: 368475:3ec061a154f2
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Jul 14 20:13:21 2022 +0000

description:
Misc KNF and cosmetics.

diffstat:

 sys/arch/luna68k/dev/lunafb.c |  28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diffs (83 lines):

diff -r 08c0e160cb1a -r 3ec061a154f2 sys/arch/luna68k/dev/lunafb.c
--- a/sys/arch/luna68k/dev/lunafb.c     Thu Jul 14 19:55:56 2022 +0000
+++ b/sys/arch/luna68k/dev/lunafb.c     Thu Jul 14 20:13:21 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.45 2022/07/14 19:55:56 tsutsui Exp $ */
+/* $NetBSD: lunafb.c,v 1.46 2022/07/14 20:13:21 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.45 2022/07/14 19:55:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.46 2022/07/14 20:13:21 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -322,20 +322,24 @@
 omgetcmap(struct omfb_softc *sc, struct wsdisplay_cmap *p)
 {
        u_int index = p->index, count = p->count;
-       int cmsize, error;
+       u_int cmsize;
+       int error;
 
        cmsize = sc->sc_dc->dc_cmsize;
        if (index >= cmsize || count > cmsize - index)
                return EINVAL;
 
        error = copyout(&sc->sc_dc->dc_cmap.r[index], p->red, count);
-       if (error)
+       if (error != 0)
                return error;
        error = copyout(&sc->sc_dc->dc_cmap.g[index], p->green, count);
-       if (error)
+       if (error != 0)
                return error;
        error = copyout(&sc->sc_dc->dc_cmap.b[index], p->blue, count);
-       return error;
+       if (error != 0)
+               return error;
+
+       return 0;
 }
 
 static int
@@ -343,20 +347,22 @@
 {
        struct hwcmap cmap;
        u_int index = p->index, count = p->count;
-       int cmsize, i, error;
+       u_int cmsize;
+       int i, error;
 
        cmsize = sc->sc_dc->dc_cmsize;
+
        if (index >= cmsize || count > cmsize - index)
                return EINVAL;
 
        error = copyin(p->red, &cmap.r[index], count);
-       if (error)
+       if (error != 0)
                return error;
        error = copyin(p->green, &cmap.g[index], count);
-       if (error)
+       if (error != 0)
                return error;
        error = copyin(p->blue, &cmap.b[index], count);
-       if (error)
+       if (error != 0)
                return error;
 
        memcpy(&sc->sc_dc->dc_cmap.r[index], &cmap.r[index], count);
@@ -495,7 +501,7 @@
        ri = &dc->dc_ri;
        ri->ri_width = dc->dc_wid;
        ri->ri_height = dc->dc_ht;
-       ri->ri_depth = 1;       /* since planes are independently addressed */
+       ri->ri_depth = 1;       /* since planes are independently addressed */
        ri->ri_stride = dc->dc_rowbytes;
        ri->ri_bits = (void *)dc->dc_videobase;
        ri->ri_flg = RI_CENTER;



Home | Main Index | Thread Index | Old Index