diff options
author | Colin Ian King <colin.king@canonical.com> | 2020-02-22 02:11:43 +0300 |
---|---|---|
committer | Li Yang <leoyang.li@nxp.com> | 2020-02-22 02:17:42 +0300 |
commit | 6a7f10c795743a7f81e89df99866d7532811c324 (patch) | |
tree | 7c5e0ad12caf854a5414811d8123d79a9cd87f30 /drivers/soc/fsl/dpio | |
parent | 3b2abda7d28c69f564c1157b9b9c21ef40092ee9 (diff) | |
download | linux-6a7f10c795743a7f81e89df99866d7532811c324.tar.xz |
soc: fsl: dpio: fix dereference of pointer p before null check
Pointer p is currently being dereferenced before it is null
checked on a memory allocation failure check. Fix this by
checking if p is null before dereferencing it.
Addresses-Coverity: ("Dereference before null check")
Fixes: 3b2abda7d28c ("soc: fsl: dpio: Replace QMAN array mode with ring mode enqueue")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Li Yang <leoyang.li@nxp.com>
Diffstat (limited to 'drivers/soc/fsl/dpio')
-rw-r--r-- | drivers/soc/fsl/dpio/qbman-portal.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c index 740ee0d19582..d1f49caa5b13 100644 --- a/drivers/soc/fsl/dpio/qbman-portal.c +++ b/drivers/soc/fsl/dpio/qbman-portal.c @@ -249,10 +249,11 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d) u32 mask_size; u32 eqcr_pi; - spin_lock_init(&p->access_spinlock); - if (!p) return NULL; + + spin_lock_init(&p->access_spinlock); + p->desc = d; p->mc.valid_bit = QB_VALID_BIT; p->sdq = 0; |