From 12b792ef3f85b89a0851284202886202579814d3 Mon Sep 17 00:00:00 2001 From: Ralph Metzler Date: Tue, 16 May 2017 21:24:48 +0200 Subject: [PATCH] remove possible mutex deadlock --- frontends/cxd2843.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontends/cxd2843.c b/frontends/cxd2843.c index e91153b..f8dd623 100644 --- a/frontends/cxd2843.c +++ b/frontends/cxd2843.c @@ -270,9 +270,10 @@ static int writebitsx(struct cxd_state *cxd, u8 Bank, u8 Address, mutex_lock(&cxd->mutex); status = readregsx_unlocked(cxd, Bank, Address, &tmp, 1); if (status < 0) - return status; + goto out; tmp = (tmp & ~Mask) | Value; status = writeregsx_unlocked(cxd, Bank, Address, &tmp, 1); +out: mutex_unlock(&cxd->mutex); return status; } @@ -286,9 +287,10 @@ static int writebitst(struct cxd_state *cxd, u8 Bank, u8 Address, mutex_lock(&cxd->mutex); status = readregst_unlocked(cxd, Bank, Address, &Tmp, 1); if (status < 0) - return status; + goto out; Tmp = (Tmp & ~Mask) | Value; status = writeregst_unlocked(cxd, Bank, Address, &Tmp, 1); +out: mutex_unlock(&cxd->mutex); return status; }