summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLiu Ying <victor.liu@nxp.com>2018-08-31 10:42:19 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:33:39 +0800
commit7cd5df6ddc15e15b2d4cf99c2b0882f752ceb0e0 (patch)
tree81d114a3201b9352c0c101ca1aef1ea18c909fd6 /drivers
parent570683987dc64928c21de1fb0cbc52e418fe6ba9 (diff)
MLK-19411 gpu: imx: dpu: units: Fix bailout path of dpu_*_get()
If a DPU unit is already in use, the bailout path of dpu_{unit}_get() would wrongly dereference the pointer of ERR_PTR(-EBUSY). This patch fixes this issue. Signed-off-by: Liu Ying <victor.liu@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/imx/dpu/dpu-constframe.c8
-rw-r--r--drivers/gpu/imx/dpu/dpu-disengcfg.c8
-rw-r--r--drivers/gpu/imx/dpu/dpu-extdst.c8
-rw-r--r--drivers/gpu/imx/dpu/dpu-fetchdecode.c6
-rw-r--r--drivers/gpu/imx/dpu/dpu-fetcheco.c6
-rw-r--r--drivers/gpu/imx/dpu/dpu-fetchlayer.c6
-rw-r--r--drivers/gpu/imx/dpu/dpu-fetchwarp.c6
-rw-r--r--drivers/gpu/imx/dpu/dpu-framegen.c6
-rw-r--r--drivers/gpu/imx/dpu/dpu-hscaler.c8
-rw-r--r--drivers/gpu/imx/dpu/dpu-layerblend.c6
-rw-r--r--drivers/gpu/imx/dpu/dpu-tcon.c8
-rw-r--r--drivers/gpu/imx/dpu/dpu-vscaler.c6
12 files changed, 41 insertions, 41 deletions
diff --git a/drivers/gpu/imx/dpu/dpu-constframe.c b/drivers/gpu/imx/dpu/dpu-constframe.c
index d0148306524c..57206bb1c6af 100644
--- a/drivers/gpu/imx/dpu/dpu-constframe.c
+++ b/drivers/gpu/imx/dpu/dpu-constframe.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -149,12 +149,12 @@ struct dpu_constframe *dpu_cf_get(struct dpu_soc *dpu, int id)
mutex_lock(&cf->mutex);
if (cf->inuse) {
- cf = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&cf->mutex);
+ return ERR_PTR(-EBUSY);
}
cf->inuse = true;
-out:
+
mutex_unlock(&cf->mutex);
return cf;
diff --git a/drivers/gpu/imx/dpu/dpu-disengcfg.c b/drivers/gpu/imx/dpu/dpu-disengcfg.c
index 007da25d4f98..76e218831532 100644
--- a/drivers/gpu/imx/dpu/dpu-disengcfg.c
+++ b/drivers/gpu/imx/dpu/dpu-disengcfg.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -93,12 +93,12 @@ struct dpu_disengcfg *dpu_dec_get(struct dpu_soc *dpu, int id)
mutex_lock(&dec->mutex);
if (dec->inuse) {
- dec = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&dec->mutex);
+ return ERR_PTR(-EBUSY);
}
dec->inuse = true;
-out:
+
mutex_unlock(&dec->mutex);
return dec;
diff --git a/drivers/gpu/imx/dpu/dpu-extdst.c b/drivers/gpu/imx/dpu/dpu-extdst.c
index ab79fe6a02c8..09a36a98742f 100644
--- a/drivers/gpu/imx/dpu/dpu-extdst.c
+++ b/drivers/gpu/imx/dpu/dpu-extdst.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -418,12 +418,12 @@ struct dpu_extdst *dpu_ed_get(struct dpu_soc *dpu, int id)
mutex_lock(&ed->mutex);
if (ed->inuse) {
- ed = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&ed->mutex);
+ return ERR_PTR(-EBUSY);
}
ed->inuse = true;
-out:
+
mutex_unlock(&ed->mutex);
return ed;
diff --git a/drivers/gpu/imx/dpu/dpu-fetchdecode.c b/drivers/gpu/imx/dpu/dpu-fetchdecode.c
index cbf4ca9cf3c8..b329ab600f45 100644
--- a/drivers/gpu/imx/dpu/dpu-fetchdecode.c
+++ b/drivers/gpu/imx/dpu/dpu-fetchdecode.c
@@ -664,12 +664,12 @@ struct dpu_fetchunit *dpu_fd_get(struct dpu_soc *dpu, int id)
mutex_lock(&fu->mutex);
if (fu->inuse) {
- fu = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&fu->mutex);
+ return ERR_PTR(-EBUSY);
}
fu->inuse = true;
-out:
+
mutex_unlock(&fu->mutex);
return fu;
diff --git a/drivers/gpu/imx/dpu/dpu-fetcheco.c b/drivers/gpu/imx/dpu/dpu-fetcheco.c
index 903fddc3e84b..2b851f1e5a13 100644
--- a/drivers/gpu/imx/dpu/dpu-fetcheco.c
+++ b/drivers/gpu/imx/dpu/dpu-fetcheco.c
@@ -328,12 +328,12 @@ struct dpu_fetchunit *dpu_fe_get(struct dpu_soc *dpu, int id)
mutex_lock(&fu->mutex);
if (fu->inuse) {
- fu = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&fu->mutex);
+ return ERR_PTR(-EBUSY);
}
fu->inuse = true;
-out:
+
mutex_unlock(&fu->mutex);
return fu;
diff --git a/drivers/gpu/imx/dpu/dpu-fetchlayer.c b/drivers/gpu/imx/dpu/dpu-fetchlayer.c
index 15738a051fce..74624136312d 100644
--- a/drivers/gpu/imx/dpu/dpu-fetchlayer.c
+++ b/drivers/gpu/imx/dpu/dpu-fetchlayer.c
@@ -218,12 +218,12 @@ struct dpu_fetchunit *dpu_fl_get(struct dpu_soc *dpu, int id)
mutex_lock(&fu->mutex);
if (fu->inuse) {
- fu = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&fu->mutex);
+ return ERR_PTR(-EBUSY);
}
fu->inuse = true;
-out:
+
mutex_unlock(&fu->mutex);
return fu;
diff --git a/drivers/gpu/imx/dpu/dpu-fetchwarp.c b/drivers/gpu/imx/dpu/dpu-fetchwarp.c
index 673c738da8a7..2e0a90af26cd 100644
--- a/drivers/gpu/imx/dpu/dpu-fetchwarp.c
+++ b/drivers/gpu/imx/dpu/dpu-fetchwarp.c
@@ -218,12 +218,12 @@ struct dpu_fetchunit *dpu_fw_get(struct dpu_soc *dpu, int id)
mutex_lock(&fu->mutex);
if (fu->inuse) {
- fu = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&fu->mutex);
+ return ERR_PTR(-EBUSY);
}
fu->inuse = true;
-out:
+
mutex_unlock(&fu->mutex);
return fu;
diff --git a/drivers/gpu/imx/dpu/dpu-framegen.c b/drivers/gpu/imx/dpu/dpu-framegen.c
index 981aefe96488..9f28c13889b4 100644
--- a/drivers/gpu/imx/dpu/dpu-framegen.c
+++ b/drivers/gpu/imx/dpu/dpu-framegen.c
@@ -529,12 +529,12 @@ struct dpu_framegen *dpu_fg_get(struct dpu_soc *dpu, int id)
mutex_lock(&fg->mutex);
if (fg->inuse) {
- fg = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&fg->mutex);
+ return ERR_PTR(-EBUSY);
}
fg->inuse = true;
-out:
+
mutex_unlock(&fg->mutex);
return fg;
diff --git a/drivers/gpu/imx/dpu/dpu-hscaler.c b/drivers/gpu/imx/dpu/dpu-hscaler.c
index d9e34bce46bc..4edd9cd6c3c8 100644
--- a/drivers/gpu/imx/dpu/dpu-hscaler.c
+++ b/drivers/gpu/imx/dpu/dpu-hscaler.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -316,12 +316,12 @@ struct dpu_hscaler *dpu_hs_get(struct dpu_soc *dpu, int id)
mutex_lock(&hs->mutex);
if (hs->inuse) {
- hs = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&hs->mutex);
+ return ERR_PTR(-EBUSY);
}
hs->inuse = true;
-out:
+
mutex_unlock(&hs->mutex);
return hs;
diff --git a/drivers/gpu/imx/dpu/dpu-layerblend.c b/drivers/gpu/imx/dpu/dpu-layerblend.c
index c18420988df7..718c8db05209 100644
--- a/drivers/gpu/imx/dpu/dpu-layerblend.c
+++ b/drivers/gpu/imx/dpu/dpu-layerblend.c
@@ -329,12 +329,12 @@ struct dpu_layerblend *dpu_lb_get(struct dpu_soc *dpu, int id)
mutex_lock(&lb->mutex);
if (lb->inuse) {
- lb = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&lb->mutex);
+ return ERR_PTR(-EBUSY);
}
lb->inuse = true;
-out:
+
mutex_unlock(&lb->mutex);
return lb;
diff --git a/drivers/gpu/imx/dpu/dpu-tcon.c b/drivers/gpu/imx/dpu/dpu-tcon.c
index a0a94ce0f47d..0e66a9488edb 100644
--- a/drivers/gpu/imx/dpu/dpu-tcon.c
+++ b/drivers/gpu/imx/dpu/dpu-tcon.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -207,12 +207,12 @@ struct dpu_tcon *dpu_tcon_get(struct dpu_soc *dpu, int id)
mutex_lock(&tcon->mutex);
if (tcon->inuse) {
- tcon = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&tcon->mutex);
+ return ERR_PTR(-EBUSY);
}
tcon->inuse = true;
-out:
+
mutex_unlock(&tcon->mutex);
return tcon;
diff --git a/drivers/gpu/imx/dpu/dpu-vscaler.c b/drivers/gpu/imx/dpu/dpu-vscaler.c
index d58042b80402..2f851f07644b 100644
--- a/drivers/gpu/imx/dpu/dpu-vscaler.c
+++ b/drivers/gpu/imx/dpu/dpu-vscaler.c
@@ -365,12 +365,12 @@ struct dpu_vscaler *dpu_vs_get(struct dpu_soc *dpu, int id)
mutex_lock(&vs->mutex);
if (vs->inuse) {
- vs = ERR_PTR(-EBUSY);
- goto out;
+ mutex_unlock(&vs->mutex);
+ return ERR_PTR(-EBUSY);
}
vs->inuse = true;
-out:
+
mutex_unlock(&vs->mutex);
return vs;