From 808423c90c113294c09faafafebdf4556a093e80 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Dec 2003 22:47:58 -0800 Subject: [PATCH] [PATCH] small cleanup udev-remove.c Here is a small cleanup. It replaces the malloc in udev-remove.c with a struct, like we do in udev-add.c --- udev-remove.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/udev-remove.c b/udev-remove.c index 6d7e2ad2..c5de6c82 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -118,30 +118,26 @@ static int delete_node(struct udevice *dev) */ int udev_remove_device(char *path, char *subsystem) { - struct udevice *dev; + struct udevice dev; char *temp; int retval; - dev = malloc(sizeof(*dev)); - if (dev == NULL) - return -ENOMEM; - memset(dev, 0, sizeof(*dev)); + memset(&dev, 0, sizeof(dev)); - retval = udevdb_get_dev(path, dev); + retval = udevdb_get_dev(path, &dev); if (retval) { dbg("'%s' not found in database, falling back on default name", path); temp = strrchr(path, '/'); if (temp == NULL) return -ENODEV; - strncpy(dev->name, &temp[1], sizeof(dev->name)); + strncpy(dev.name, &temp[1], sizeof(dev.name)); } - dbg("name is '%s'", dev->name); + dbg("name is '%s'", dev.name); udevdb_delete_dev(path); - sysbus_send_remove(dev->name, path); + sysbus_send_remove(dev.name, path); - retval = delete_node(dev); - free(dev); + retval = delete_node(&dev); return retval; } -- 2.39.5