summaryrefslogtreecommitdiff
path: root/udev-remove.c
diff options
context:
space:
mode:
Diffstat (limited to 'udev-remove.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;
}