All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] minor do_syslog cleanup
@ 2000-11-30 14:26 Steve Grubb
  0 siblings, 0 replies; only message in thread
From: Steve Grubb @ 2000-11-30 14:26 UTC (permalink / raw)
  To: linux-kernel

Hello,

This patch removes extra setting of the error value in the do_syslog
function. The patch is against 2.2.16, but printk.c seems to have changed
little so it probably applies against other kernels.

See Ya,
Steve Grubb

--------------------

--- printk.orig Thu Nov 30 07:58:58 2000
+++ printk.c    Thu Nov 30 08:55:07 2000
@@ -123,19 +123,18 @@
        unsigned long i, j, limit, count;
        int do_clear = 0;
        char c;
-       int error = -EPERM;
+       int error = 0;

-       error = 0;
        switch (type) {
        case 0:         /* Close log */
                break;
        case 1:         /* Open log */
                break;
        case 2:         /* Read from log */
-               error = -EINVAL;
-               if (!buf || len < 0)
+               if (!buf || len < 0) {
+                       error = -EINVAL;
                        goto out;
-               error = 0;
+               }
                if (!len)
                        goto out;
                error = verify_area(VERIFY_WRITE,buf,len);
@@ -163,10 +162,10 @@
                do_clear = 1;
                /* FALL THRU */
        case 3:         /* Read last kernel messages */
-               error = -EINVAL;
-               if (!buf || len < 0)
+               if (!buf || len < 0) {
+                       error = -EINVAL;
                        goto out;
-               error = 0;
+               }
                if (!len)
                        goto out;
                error = verify_area(VERIFY_WRITE,buf,len);
@@ -224,15 +223,15 @@
                spin_unlock_irq(&console_lock);
                break;
        case 8:
-               error = -EINVAL;
-               if (len < 1 || len > 8)
+               if (len < 1 || len > 8) {
+                       error = -EINVAL;
                        goto out;
+               }
                if (len < minimum_console_loglevel)
                        len = minimum_console_loglevel;
                spin_lock_irq(&console_lock);
                console_loglevel = len;
                spin_unlock_irq(&console_lock);
-               error = 0;
                break;
        default:
                error = -EINVAL;


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-11-30 14:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-30 14:26 [PATCH] minor do_syslog cleanup Steve Grubb

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.