Skip to content

Commit 704b36f

Browse files
jfischer-nofabiobaltieri
authored andcommitted
usb: device_next: remove redundant memset() after net_buf_alloc.*()
With changes introduced in commit 6a3602a ("net: buf: Clear `user_data` on allocation") our memset() calls are redundant. Signed-off-by: Johann Fischer <[email protected]>
1 parent d9caf60 commit 704b36f

File tree

9 files changed

+0
-11
lines changed

9 files changed

+0
-11
lines changed

drivers/usb/udc/udc_common.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,6 @@ struct net_buf *udc_ep_buf_alloc(const struct device *dev,
665665
}
666666

667667
bi = udc_get_buf_info(buf);
668-
memset(bi, 0, sizeof(struct udc_buf_info));
669668
bi->ep = ep;
670669
LOG_DBG("Allocate net_buf, ep 0x%02x, size %zd", ep, size);
671670

samples/subsys/usb/webusb-next/src/sfunc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ struct net_buf *sfunc_buf_alloc(struct usbd_class_data *const c_data,
133133
}
134134

135135
bi = udc_get_buf_info(buf);
136-
memset(bi, 0, sizeof(struct udc_buf_info));
137136
bi->ep = ep;
138137

139138
return buf;

subsys/usb/device_next/class/bt_hci.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ struct net_buf *bt_hci_buf_alloc(const uint8_t ep)
169169
}
170170

171171
bi = udc_get_buf_info(buf);
172-
memset(bi, 0, sizeof(struct udc_buf_info));
173172
bi->ep = ep;
174173

175174
return buf;

subsys/usb/device_next/class/usbd_cdc_acm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ struct net_buf *cdc_acm_buf_alloc(const uint8_t ep)
132132
}
133133

134134
bi = udc_get_buf_info(buf);
135-
memset(bi, 0, sizeof(struct udc_buf_info));
136135
bi->ep = ep;
137136

138137
return buf;

subsys/usb/device_next/class/usbd_cdc_ecm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ static struct net_buf *cdc_ecm_buf_alloc(const uint8_t ep)
164164
}
165165

166166
bi = udc_get_buf_info(buf);
167-
memset(bi, 0, sizeof(struct udc_buf_info));
168167
bi->ep = ep;
169168

170169
return buf;

subsys/usb/device_next/class/usbd_cdc_ncm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ static struct net_buf *cdc_ncm_buf_alloc(const uint8_t ep)
307307
}
308308

309309
bi = udc_get_buf_info(buf);
310-
memset(bi, 0, sizeof(struct udc_buf_info));
311310
bi->ep = ep;
312311

313312
return buf;

subsys/usb/device_next/class/usbd_hid.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ static struct net_buf *hid_buf_alloc_ext(const struct hid_device_config *const d
513513
}
514514

515515
bi = udc_get_buf_info(buf);
516-
memset(bi, 0, sizeof(struct udc_buf_info));
517516
bi->ep = ep;
518517

519518
return buf;
@@ -531,7 +530,6 @@ static struct net_buf *hid_buf_alloc(const struct hid_device_config *const dcfg,
531530
}
532531

533532
bi = udc_get_buf_info(buf);
534-
memset(bi, 0, sizeof(struct udc_buf_info));
535533
bi->ep = ep;
536534

537535
return buf;

subsys/usb/device_next/class/usbd_msc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ static struct net_buf *msc_buf_alloc(const uint8_t ep)
138138
}
139139

140140
bi = udc_get_buf_info(buf);
141-
memset(bi, 0, sizeof(struct udc_buf_info));
142141
bi->ep = ep;
143142

144143
return buf;

subsys/usb/device_next/class/usbd_uac2.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ uac2_buf_alloc(const uint8_t ep, void *data, uint16_t size)
231231
}
232232

233233
bi = udc_get_buf_info(buf);
234-
memset(bi, 0, sizeof(struct udc_buf_info));
235234
bi->ep = ep;
236235

237236
if (USB_EP_DIR_IS_OUT(ep)) {
@@ -378,7 +377,6 @@ static void write_explicit_feedback(struct usbd_class_data *const c_data,
378377
}
379378

380379
bi = udc_get_buf_info(buf);
381-
memset(bi, 0, sizeof(struct udc_buf_info));
382380
bi->ep = ep;
383381

384382
fb_value = ctx->ops->feedback_cb(dev, terminal, ctx->user_data);

0 commit comments

Comments
 (0)