Commit 75ecb9dd authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Felipe Balbi

usb: dwc3: Free resource immediately after use

When we read an array of integers from device properties,
the temporary buffer is allocated.

However, in case of dwc3_set_incr_burst_type() it's not freed.
Free allocated buffer immediately after use.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent c0c61471
...@@ -828,6 +828,7 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc) ...@@ -828,6 +828,7 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc)
ret = device_property_read_u32_array(dev, ret = device_property_read_u32_array(dev,
"snps,incr-burst-type-adjustment", vals, ntype); "snps,incr-burst-type-adjustment", vals, ntype);
if (ret) { if (ret) {
kfree(vals);
dev_err(dev, "Error to get property\n"); dev_err(dev, "Error to get property\n");
return; return;
} }
...@@ -846,6 +847,8 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc) ...@@ -846,6 +847,8 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc)
incrx_mode = INCRX_BURST_MODE; incrx_mode = INCRX_BURST_MODE;
} }
kfree(vals);
/* Enable Undefined Length INCR Burst and Enable INCRx Burst */ /* Enable Undefined Length INCR Burst and Enable INCRx Burst */
cfg &= ~DWC3_GSBUSCFG0_INCRBRST_MASK; cfg &= ~DWC3_GSBUSCFG0_INCRBRST_MASK;
if (incrx_mode) if (incrx_mode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment