On Tue, 5 May 2015, Christos Zoulas wrote:

Module Name:    src
Committed By:   pgoyette
Date:           Mon May  4 23:50:36 UTC 2015

Modified Files:
        src/sys/dev/sysmon: sysmon.c

Log Message:
If autoload of the subcomponent module fails, don't try to call its
open routine.  Just return an error.

Hopefully this will fix the recently reported issues with atf tests
running on xen guest.

-=-=-=-=-=-

#include <sys/param.h>
#include <sys/conf.h>
@@ -153,8 +153,10 @@ sysmonopen(dev_t dev, int flag, int mode
                        error = module_autoload(sysmon_mod[minor(dev)],
                                                MODULE_CLASS_MISC);

I am confused; at this point if autoload returned an error, why bother
continuing and losing the error return from the autoload? Why not add:
                        if (error)
                                break;

                        mutex_enter(&sysmon_minor_mtx);
-                       if (sysmon_opvec_table[minor(dev)] == NULL)
+                       if (sysmon_opvec_table[minor(dev)] == NULL) {
                                error = ENODEV;
+                               break;
+                       }
                }
                error = (sysmon_opvec_table[minor(dev)]->so_open)(dev, flag,
                    mode, l);


-=-=-=-=-=-


Yeah, makes sense.  I will update accordingly.


-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
-------------------------------------------------------------------------

Reply via email to