Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/dwc2/dist Fix error path, kmem_free doesn't...
details: https://anonhg.NetBSD.org/src/rev/79b0a230f17e
branches: trunk
changeset: 461882:79b0a230f17e
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Jul 14 13:55:43 2019 +0000
description:
Fix error path, kmem_free doesn't allow NULL pointers.
Fix compilation with CONFIG_USB_DWC2_TRACK_MISSED_SOFS.
diffstat:
sys/external/bsd/dwc2/dist/dwc2_hcd.c | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
diffs (50 lines):
diff -r ca0b3cf48fe1 -r 79b0a230f17e sys/external/bsd/dwc2/dist/dwc2_hcd.c
--- a/sys/external/bsd/dwc2/dist/dwc2_hcd.c Sun Jul 14 11:27:33 2019 +0000
+++ b/sys/external/bsd/dwc2/dist/dwc2_hcd.c Sun Jul 14 13:55:43 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc2_hcd.c,v 1.22 2018/08/27 17:13:07 riastradh Exp $ */
+/* $NetBSD: dwc2_hcd.c,v 1.23 2019/07/14 13:55:43 mlelstv Exp $ */
/*
* hcd.c - DesignWare HS OTG Controller host-mode routines
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.22 2018/08/27 17:13:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_hcd.c,v 1.23 2019/07/14 13:55:43 mlelstv Exp $");
#include <sys/types.h>
#include <sys/kmem.h>
@@ -2424,13 +2424,16 @@
error3:
dwc2_hcd_release(hsotg);
error2:
- kmem_free(hsotg->core_params, sizeof(*hsotg->core_params));
+ if (hsotg->core_params != NULL)
+ kmem_free(hsotg->core_params, sizeof(*hsotg->core_params));
#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
- kmem_free(hsotg->last_frame_num_array,
- sizeof(*hsotg->last_frame_num_array) * FRAME_NUM_ARRAY_SIZE);
- kmem_free(hsotg->frame_num_array,
- sizeof(*hsotg->frame_num_array) * FRAME_NUM_ARRAY_SIZE);
+ if (hsotg->last_frame_num_array != NULL)
+ kmem_free(hsotg->last_frame_num_array,
+ sizeof(*hsotg->last_frame_num_array) * FRAME_NUM_ARRAY_SIZE);
+ if (hsotg->frame_num_array != NULL)
+ kmem_free(hsotg->frame_num_array,
+ sizeof(*hsotg->frame_num_array) * FRAME_NUM_ARRAY_SIZE);
#endif
dev_err(hsotg->dev, "%s() FAILED, returning %d\n", __func__, retval);
@@ -2460,7 +2463,7 @@
dwc2_hcd_release(hsotg);
#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
- kfree(hsotg->last_frame_num_array);
- kfree(hsotg->frame_num_array);
+ kmem_free(hsotg->last_frame_num_array, sizeof(*hsotg->last_frame_num_array) * FRAME_NUM_ARRAY_SIZE);
+ kmem_free(hsotg->frame_num_array, sizeof(*hsotg->frame_num_array) * FRAME_NUM_ARRAY_SIZE);
#endif
}
Home |
Main Index |
Thread Index |
Old Index