Merge "usb: gadget: composite: fix dereference after null check coverify warning"

This commit is contained in:
Linux Build Service Account 2016-09-23 20:19:05 -07:00 committed by Gerrit - the friendly Code Review server
commit 6ae0998ab6
3 changed files with 9 additions and 4 deletions

View file

@ -1963,6 +1963,8 @@ unknown:
break; break;
case USB_RECIP_ENDPOINT: case USB_RECIP_ENDPOINT:
if (!cdev->config)
break;
endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f); endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f);
list_for_each_entry(f, &cdev->config->functions, list) { list_for_each_entry(f, &cdev->config->functions, list) {
if (test_bit(endp, f->endpoints)) if (test_bit(endp, f->endpoints))

View file

@ -925,7 +925,8 @@ int usbpd_send_vdm(struct usbpd *pd, u32 vdm_hdr, const u32 *vdos, int num_vdos)
return -ENOMEM; return -ENOMEM;
vdm_tx->data[0] = vdm_hdr; vdm_tx->data[0] = vdm_hdr;
memcpy(&vdm_tx->data[1], vdos, num_vdos * sizeof(u32)); if (vdos && num_vdos)
memcpy(&vdm_tx->data[1], vdos, num_vdos * sizeof(u32));
vdm_tx->size = num_vdos + 1; /* include the header */ vdm_tx->size = num_vdos + 1; /* include the header */
/* VDM will get sent in PE_SRC/SNK_READY state handling */ /* VDM will get sent in PE_SRC/SNK_READY state handling */

View file

@ -445,8 +445,10 @@ int pd_phy_write(u16 hdr, const u8 *data, size_t data_len,
dev_dbg(pdphy->dev, "%s: hdr %x frame type %d timeout %u\n", dev_dbg(pdphy->dev, "%s: hdr %x frame type %d timeout %u\n",
__func__, hdr, type, timeout_ms); __func__, hdr, type, timeout_ms);
print_hex_dump_debug("tx data obj:", DUMP_PREFIX_NONE, 32, 4,
data, data_len, false); if (data && data_len)
print_hex_dump_debug("tx data obj:", DUMP_PREFIX_NONE, 32, 4,
data, data_len, false);
if (!pdphy) { if (!pdphy) {
pr_err("%s: pdphy not found\n", __func__); pr_err("%s: pdphy not found\n", __func__);
@ -472,7 +474,7 @@ int pd_phy_write(u16 hdr, const u8 *data, size_t data_len,
if (ret) if (ret)
return ret; return ret;
if (data_len) { if (data && data_len) {
/* write data objects of SOP message */ /* write data objects of SOP message */
ret = pdphy_bulk_reg_write(pdphy, USB_PDPHY_TX_BUFFER_DATA, ret = pdphy_bulk_reg_write(pdphy, USB_PDPHY_TX_BUFFER_DATA,
data, data_len); data, data_len);