[PATCH 14/24] usb: remove unnecessary variable

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

 



"tmp" is only used to store the size of the descriptor. The name is not
very meaningful and "tmp" is not even used everywhere it could be used.
Just replace by using sizeof() directly where needed.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/usb/core/usb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index ad1d78b8fb..e5c80aa1da 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -309,7 +309,6 @@ static int usb_get_descriptor(struct usb_device *dev, unsigned char type,
 int usb_new_device(struct usb_device *dev)
 {
 	int err;
-	int tmp;
 	void *buf;
 	struct usb_device_descriptor *desc;
 	struct usb_device *parent = dev->parent;
@@ -384,17 +383,16 @@ int usb_new_device(struct usb_device *dev)
 
 	mdelay(10);	/* Let the SET_ADDRESS settle */
 
-	tmp = sizeof(*dev->descriptor);
-
 	err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
 				 dev->descriptor, sizeof(*dev->descriptor));
-	if (err < tmp) {
+	if (err < sizeof(*dev->descriptor)) {
 		if (err < 0)
 			dev_err(&dev->dev, "unable to get device descriptor (error=%d)\n",
 			       err);
 		else
 			dev_err(&dev->dev, "USB device descriptor short read " \
-				"(expected %i, got %i)\n", tmp, err);
+				"(expected %zu, got %i)\n",
+				sizeof(*dev->descriptor), err);
 		goto err_out;
 	}
 	/* correct le values */
-- 
2.26.0.rc2


_______________________________________________
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