From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ong Hock Yu Date: Wed, 28 Nov 2018 04:47:28 +0000 Subject: [PATCH] media: intel-ipu4: [ICI] Use fixed delay to avoid buffer memory double free. The ipu_lib_call_notrace API when called multiple time caused buffer memory being double freed. Instead of doing looping use fix delay. Change-Id: I516cda662d8e2dbc324eda1e0be886259f13dcc6 Tracked-On: OAM-72129 Signed-off-by: Ong Hock Yu --- drivers/media/pci/intel/ici/ici-isys-stream.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/media/pci/intel/ici/ici-isys-stream.c b/drivers/media/pci/intel/ici/ici-isys-stream.c index 3fed1545327d..33101efcc2a3 100644 --- a/drivers/media/pci/intel/ici/ici-isys-stream.c +++ b/drivers/media/pci/intel/ici/ici-isys-stream.c @@ -139,7 +139,6 @@ static int pipeline_set_power(struct ici_isys_stream *as, static int intel_ipu4_isys_library_close(struct ici_isys *isys) { struct device *dev = &isys->adev->dev; - int timeout = IPU_ISYS_TURNOFF_TIMEOUT; int rval; /* @@ -151,13 +150,10 @@ static int intel_ipu4_isys_library_close(struct ici_isys *isys) if (rval) dev_err(dev, "Device close failure: %d\n", rval); - /* release probably fails if the close failed. Let's try still */ - do { - usleep_range(IPU_ISYS_TURNOFF_DELAY_US, - 2 * IPU_ISYS_TURNOFF_DELAY_US); - rval = ipu_lib_call_notrace(device_release, isys, 0); - timeout--; - } while (rval != 0 && timeout); + //sleep for 0.5s to 1s + usleep_range(500 * IPU_ISYS_TURNOFF_DELAY_US, + 1000 * IPU_ISYS_TURNOFF_DELAY_US); + rval = ipu_lib_call_notrace(device_release, isys, 0); if (!rval) isys->fwcom = NULL; /* No further actions needed */ -- https://clearlinux.org