The helper stdio_clone only has a single caller, so it certainly
doesn't need to be public. But in fact, it is merely an open-coded
memdup() - which for some reason uses calloc() even if the whole
allocation is obviously immediately overwritten.
Drop it and just use memdup() directly.
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
return NULL;
}
-struct stdio_dev *stdio_clone(struct stdio_dev *dev)
-{
- struct stdio_dev *_dev;
-
- if (!dev)
- return NULL;
-
- _dev = calloc(1, sizeof(struct stdio_dev));
- if (!_dev)
- return NULL;
-
- memcpy(_dev, dev, sizeof(struct stdio_dev));
-
- return _dev;
-}
-
int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp)
{
struct stdio_dev *_dev;
- _dev = stdio_clone(dev);
+ _dev = memdup(dev, sizeof(*dev));
if (!_dev)
return -ENODEV;
list_add_tail(&_dev->list, &devs.list);
int stdio_deregister_dev(struct stdio_dev *dev, int force);
struct list_head *stdio_get_list(void);
struct stdio_dev *stdio_get_by_name(const char *name);
-struct stdio_dev *stdio_clone(struct stdio_dev *dev);
int drv_lcd_init(void);
int drv_video_init(void);