Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1258266pxa; Thu, 20 Aug 2020 06:58:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgNIM7dNVQkQvHr3ne1qNEKjFjfhlzkj7KPERM2wtyktCo1Z/Olkt0Tx/AkYOmRgOckmfJ X-Received: by 2002:a17:906:3655:: with SMTP id r21mr3515194ejb.248.1597931887302; Thu, 20 Aug 2020 06:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931887; cv=none; d=google.com; s=arc-20160816; b=YCBuzdtE1GcavHuU/ZyCPqK6mhMlnXS9psde0qPil366DzgZfwcc2OZwImAwFe3XGd 2dRjQf8E8x75n12Y/bVytMPxzn99gr389YdqdJWF11S5IkxtJZux8P9EY3+utBihDTyK hsOWc4vxPXkEv1hEkrioXEYWPPxlHKOFS9O14bm6X2Cor0KBXqfIHLshXSvTDAFwxc8x xDBXk2ro31jlOsWi6v5hvuaskOFg0hjSQgzNHyL5P3kOzB7x4+GBQtbWlLtAqfB0Yhfg 9L+YS2eWp/jEKiQ4B5KaRdrNRgZDumrcxW/Py74E0OOWLtMYvzKTL9re7n48elSmiOkz WCog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nwmx8PqXEHnCkQyLG6ikNITfY066KJv2BzzHEy9ckLI=; b=AhuChx/92/iaPpdyhzo0f3sNELeM8iCHFrPnkn1zGCw9+zZsJkmCRvgBJsnu9lt1ff Kcnqxynqp5sFzLRBALRcG7FqHYs/JA9vuFPWN/LqXevLdSaLW7KBR7lgGrXF89C0Oadk 7YKqaNwel+5LW9NnCx2ubGQusaH5SDhwZiXvA8DjA7hh7wP60AFo6wRyrfWPNwFhP26P 0oaN9GaiKJ5LpjuThiogk9nbYmp/7TLFq7fkRWZyymHqSfBo9e0fCYRS2AWB74my1PAl HwYXucwopq7ylynU2HOqYuL6Kt9N4WxgNMpqzhk2LgRjconGMEkDaaRI0GD3g/vofh9Y 5ebg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fzElbNTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u18si1217587ejr.700.2020.08.20.06.57.43; Thu, 20 Aug 2020 06:58:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fzElbNTP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730735AbgHTN5B (ORCPT + 99 others); Thu, 20 Aug 2020 09:57:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:60762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727769AbgHTJZo (ORCPT ); Thu, 20 Aug 2020 05:25:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5D1C222D00; Thu, 20 Aug 2020 09:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915525; bh=Ee5Xl4plfpnoG2TwGxHJePFJ8XV8d4vHdO5DuBTacYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fzElbNTPo4zP/LrxWmFOp1KToLrLShjgNuS1dwBA8Msv60Kn54waW8VPvEMGjTi7B S4gYum3D9XZYjEHoCOu5SQSs9RssYBjnlh021P70gDb+NmKwyLu4C0AAPcAl/X69ib WP2eSc16ahf1UycqSDxmKid8rNa1405Bjn7461Kg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Stanhope , Alexandru Ardelean , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.8 045/232] iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw() Date: Thu, 20 Aug 2020 11:18:16 +0200 Message-Id: <20200820091614.962747060@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexandru Ardelean commit 65afb0932a81c1de719ceee0db0b276094b10ac8 upstream. There are 2 exit paths where the lock isn't held, but try to unlock the mutex when exiting. In these places we should just return from the function. A neater approach would be to cleanup the ad5592r_read_raw(), but that would make this patch more difficult to backport to stable versions. Fixes 56ca9db862bf3: ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs") Reported-by: Charles Stanhope Signed-off-by: Alexandru Ardelean Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/dac/ad5592r-base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/iio/dac/ad5592r-base.c +++ b/drivers/iio/dac/ad5592r-base.c @@ -413,7 +413,7 @@ static int ad5592r_read_raw(struct iio_d s64 tmp = *val * (3767897513LL / 25LL); *val = div_s64_rem(tmp, 1000000000LL, val2); - ret = IIO_VAL_INT_PLUS_MICRO; + return IIO_VAL_INT_PLUS_MICRO; } else { int mult; @@ -444,7 +444,7 @@ static int ad5592r_read_raw(struct iio_d ret = IIO_VAL_INT; break; default: - ret = -EINVAL; + return -EINVAL; } unlock: