Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/opencrypto If we get an error from devsw_attach(), don't...
details: https://anonhg.NetBSD.org/src/rev/7c14c608b195
branches: trunk
changeset: 1006766:7c14c608b195
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Mon Jan 27 02:56:15 2020 +0000
description:
If we get an error from devsw_attach(), don't destroy the error value,
since we need to return it to our caller. While we're here, improve
the value of the debug message by actually printing the error value.
diffstat:
sys/opencrypto/cryptodev.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diffs (46 lines):
diff -r 4abc8394a2ac -r 7c14c608b195 sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c Mon Jan 27 01:15:09 2020 +0000
+++ b/sys/opencrypto/cryptodev.c Mon Jan 27 02:56:15 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cryptodev.c,v 1.103 2020/01/16 15:29:24 christos Exp $ */
+/* $NetBSD: cryptodev.c,v 1.104 2020/01/27 02:56:15 pgoyette Exp $ */
/* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */
/* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.103 2020/01/16 15:29:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.104 2020/01/27 02:56:15 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2201,6 +2201,7 @@
{
int error = 0;
#ifdef _MODULE
+ int error2;
devmajor_t cmajor = NODEVMAJOR, bmajor = NODEVMAJOR;
#endif
@@ -2235,14 +2236,14 @@
error = devsw_attach(crypto_cd.cd_name, NULL, &bmajor,
&crypto_cdevsw, &cmajor);
if (error) {
- error = config_cfdata_detach(crypto_cfdata);
- if (error) {
- return error;
+ error2 = config_cfdata_detach(crypto_cfdata);
+ if (error2) {
+ return error2;
}
config_cfattach_detach(crypto_cd.cd_name, &crypto_ca);
config_cfdriver_detach(&crypto_cd);
- aprint_error("%s: unable to register devsw\n",
- crypto_cd.cd_name);
+ aprint_error("%s: unable to register devsw, error %d\n",
+ crypto_cd.cd_name, error);
return error;
}
Home |
Main Index |
Thread Index |
Old Index