summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2003-12-22 22:47:58 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:10 -0700
commit808423c90c113294c09faafafebdf4556a093e80 (patch)
tree3621733f761d127e84b8171af0460e253b55e6ae
parentca593541e63b6accd1f8c5f5592ada4b85930576 (diff)
[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
-rw-r--r--udev-remove.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/udev-remove.c b/udev-remove.c
index 6d7e2ad22a..c5de6c823f 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;
}