stdio: drop stdio_clone
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>
This commit is contained in:
committed by
Tom Rini
parent
ca1c292d2e
commit
719cacb92e
+1
-17
@@ -217,27 +217,11 @@ struct stdio_dev *stdio_get_by_name(const char *name)
|
||||
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);
|
||||
|
||||
@@ -96,7 +96,6 @@ int stdio_add_devices(void);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user