Date: Thu, 6 Mar 2025 11:03:02 GMT From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 234683726708 - main - devclass: make devclass_alloc_unit use M_NOWAIT Message-ID: <202503061103.526B32Id022652@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=234683726708cf5212d672d676d30056d4133859 commit 234683726708cf5212d672d676d30056d4133859 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2025-03-06 11:01:49 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2025-03-06 11:01:49 +0000 devclass: make devclass_alloc_unit use M_NOWAIT The only caller already does this. The routine can be called with a mutex held making M_WAITOK illegal. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/kern/subr_bus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 9506e471705c..0422352bba51 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1208,6 +1208,7 @@ devclass_get_sysctl_tree(devclass_t dc) static int devclass_alloc_unit(devclass_t dc, device_t dev, int *unitp) { + device_t *devices; const char *s; int unit = *unitp; @@ -1264,8 +1265,11 @@ devclass_alloc_unit(devclass_t dc, device_t dev, int *unitp) int newsize; newsize = unit + 1; - dc->devices = reallocf(dc->devices, - newsize * sizeof(*dc->devices), M_BUS, M_WAITOK); + devices = reallocf(dc->devices, + newsize * sizeof(*dc->devices), M_BUS, M_NOWAIT); + if (devices == NULL) + return (ENOMEM); + dc->devices = devices; memset(dc->devices + dc->maxunit, 0, sizeof(device_t) * (newsize - dc->maxunit)); dc->maxunit = newsize;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202503061103.526B32Id022652>