summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-05-01 13:52:24 -0600
committerSimon Glass <sjg@chromium.org>2016-05-17 09:54:43 -0600
commitd0773524e18d2439390c88611b49f23ca46a82be (patch)
tree4ea731d6d308274da626e7b4e8274d0c84c50a85 /drivers
parenta2040facd23b88082b9b40f0aa9bcfd495eab88e (diff)
downloadtalos-obmc-uboot-d0773524e18d2439390c88611b49f23ca46a82be.tar.gz
talos-obmc-uboot-d0773524e18d2439390c88611b49f23ca46a82be.zip
dm: blk: Free the block device name when unbound
Mark the device name as allocated so that it will be freed correctly when the device is unbound. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/blk-uclass.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index f67f9b9d55..a37239ee50 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -468,14 +468,22 @@ int blk_create_devicef(struct udevice *parent, const char *drv_name,
lbaint_t size, struct udevice **devp)
{
char dev_name[30], *str;
+ int ret;
snprintf(dev_name, sizeof(dev_name), "%s.%s", parent->name, name);
str = strdup(dev_name);
if (!str)
return -ENOMEM;
- return blk_create_device(parent, drv_name, str, if_type, devnum,
- blksz, size, devp);
+ ret = blk_create_device(parent, drv_name, str, if_type, devnum,
+ blksz, size, devp);
+ if (ret) {
+ free(str);
+ return ret;
+ }
+ device_set_name_alloced(*devp);
+
+ return ret;
}
int blk_unbind_all(int if_type)
OpenPOWER on IntegriCloud