Replace explicit malloc() + OOM check and memset() with a single call
to xzalloc().

Signed-off-by: Andrey Smirnov <andrew.smir...@gmail.com>
---
 drivers/usb/storage/usb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 8218bb2a7..d25e19473 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -541,10 +541,7 @@ static int usb_stor_probe(struct usb_device *usbdev,
        US_DEBUGP("Selected interface %d\n", (int)intf->desc.bInterfaceNumber);
 
        /* allocate us_data structure */
-       us = (struct us_data *)malloc(sizeof(struct us_data));
-       if (!us)
-               return -ENOMEM;
-       memset(us, 0, sizeof(struct us_data));
+       us = xzalloc(sizeof(*us));
 
        /* initialize the us_data structure */
        us->pusb_dev = usbdev;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to