Skip to contentSkip to conversation

sound: line6: sizeof (byte) is always 1, use that fact.

PATCH Applied Pavel Machek 2 participants 2 messages Jul 24, 2019 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sound: line6: sizeof (byte) is always 1, use that fact.

sizeof (byte) is always 1, use that fact and make interesting code explicit.

sound/usb/line6/driver.c +2 -2
index ab2ec89..387c5c2 100644
@@ -342,7 +342,7 @@ int line6_read_data(struct usb_line6 *line6, unsigned address, void *data,
 	if (address > 0xffff || datalen > 0xff)
 		return -EINVAL;
 
-	len = kmalloc(sizeof(*len), GFP_KERNEL);
+	len = kmalloc(1, GFP_KERNEL);
 	if (!len)
 		return -ENOMEM;
 
@@ -418,7 +421,7 @@ int line6_write_data(struct usb_line6 *line6, unsigned address, void *data,
 	if (address > 0xffff || datalen > 0xffff)
 		return -EINVAL;
 
-	status = kmalloc(sizeof(*status), GFP_KERNEL);
+	status = kmalloc(1, GFP_KERNEL);
 	if (!status)
 		return -ENOMEM;
 
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html