[PATCH 01/26] usb: storage: Simplify memory allocation in usb_stor_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux