
17 Feb
2016
17 Feb
'16
12:34 a.m.
On 02/14/2016 07:16 PM, Simon Glass wrote:
Update the host driver to support driver model for block devices. A future commit will remove the old code, but for now it is useful to be able to use it both with and without CONFIG_BLK.
diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c
+#ifdef CONFIG_BLK +int host_dev_bind(int devnum, char *filename) +{
- struct host_block_dev *host_dev;
- struct udevice *dev;
- char dev_name[20], *str, *fname;
...
- sprintf(dev_name, "host%d", devnum);
Use snprintf() to avoid overflow?
- str = strdup(dev_name);
- if (!str)
return -ENOMEM;
- fname = strdup(filename);
- if (!fname) {
free(str);
return -ENOMEM;
- }
Do those get free()d somewhere on unbind?
Actually, I don't see any unbind() function in this file (even before this patch).