[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH] lib/devfs: device_create(): Return NULL on errors
Hi Simon, this looks good thanks. Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx> On 29.08.19, 15:18, "Simon Kuenzer" <simon.kuenzer@xxxxxxxxx> wrote: Instead of crashing the system, return NULL on device_create(). Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> --- lib/devfs/device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/devfs/device.c b/lib/devfs/device.c index 044073a4..d67aee4a 100644 --- a/lib/devfs/device.c +++ b/lib/devfs/device.c @@ -155,8 +155,11 @@ device_create(struct driver *drv, const char *name, int flags) /* * Allocate a device structure. */ - if ((dev = malloc(sizeof(struct device))) == NULL) - UK_CRASH("device_create"); + dev = malloc(sizeof(struct device)); + if (!dev) { + uk_pr_err("Failed to allocate device memory, creation failed\n"); + return NULL; + } dev->driver = drv; device_register(dev, name, flags); -- 2.20.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |