git: e035f2783661 - main - snp(4): do not ignore errors from devfs_set_cdevpriv()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Nov 2026 03:52:36 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=e035f2783661085545d2d0ea8b9cf58f7fb3de7e
commit e035f2783661085545d2d0ea8b9cf58f7fb3de7e
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-11-24 03:26:21 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-24 03:52:08 +0000
snp(4): do not ignore errors from devfs_set_cdevpriv()
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
sys/dev/snp/snp.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 0a9b7d378c76..a2ef93173dcd 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -138,14 +138,16 @@ static int
snp_open(struct cdev *dev, int flag, int mode, struct thread *td)
{
struct snp_softc *ss;
+ int error;
/* Allocate per-snoop data. */
ss = malloc(sizeof(struct snp_softc), M_SNP, M_WAITOK|M_ZERO);
cv_init(&ss->snp_outwait, "snp out");
- devfs_set_cdevpriv(ss, snp_dtor);
-
- return (0);
+ error = devfs_set_cdevpriv(ss, snp_dtor);
+ if (error != 0)
+ snp_dtor(ss);
+ return (error);
}
static int