summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2019-03-07 00:00:11 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-11 08:11:18 +0100
commitfc7869a156c04f2671275c17777d066ab27e2bd6 (patch)
tree9e4909cfc2ce4caaa613de2c1acc362506b36791 /drivers
parent369d39adfe79334db5ed04d6f2acaf096c68b8a2 (diff)
downloadbarebox-fc7869a156c04f2671275c17777d066ab27e2bd6.tar.gz
usb: storage: Simplify memory allocation in usb_stor_probe()
Replace explicit malloc() + OOM check and memset() with a single call to xzalloc(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/storage/usb.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 8218bb2..d25e194 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;