Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3032128pxb; Mon, 18 Oct 2021 06:59:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrA9zU9dkwecELmd31rha3sXhBIpZdx3YF06X+2kodQKL22JIz5w++UXKOYM62NTBQsvd7 X-Received: by 2002:a62:dd15:0:b0:44c:61de:537 with SMTP id w21-20020a62dd15000000b0044c61de0537mr28703315pff.57.1634565583708; Mon, 18 Oct 2021 06:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565583; cv=none; d=google.com; s=arc-20160816; b=zyU4C+XEsv6dmLJEqJcxZgIlQ39BbXC1MYAXxm7KMS2tCDpm9uNj+6zkt+ogdoNohm 2r2aL1m5wA9bfPF0eUoOHuN0RZ8X7eKf+GuTQPowL3WlHZak2SSNwwIxo3Y4DPdox5MF p3uaqoxu2I6blHCfc5gJBrPhTVRmyru7h99YRjZE3Vb+jzBkVeceJ7BKNKV2Qt7eo85y yj4Oomx2fqhNO4Kv4ZbnGNC654JzC/fvgNij1da7w0TUKu8W9/Xf/AFId9rPa3/Np2JO 1lCsF/cf+MqSIhW1fvpy9e13BPOGoreN8J3maWe/0QbXEGSQ8oRaqlWuGQeHGvTCSLcr G2KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PGooUi5L0f2jadr/3n9EPLnFaDFPrMf8Gw2OUEFsoQU=; b=OJraEUN24m6H95OtJmIK5Pa2JU3oHt9ArHJxx0nga/CCRbNYwRIuvqSUkuum6GlgOs tP62by4+KX1LZZW04dQZqp9uZbvRi7RjlwOglqjrNvD/N4NcoXaupMAInLULYUHoraSh TA5vjtO6YnjXfSwMWrbAaY+DNKR4zw/e94V+jOmxHz0mKxiVLpOh6DTZSP9DDJlghBO2 z6ge8lXzC9nKquWSJfwvON5wMKHV4aop8W9UGhQw3MMAPF/xllz0tyZiYwLrhZAz+1Rb Xag8YyEJWKUpzlldm3toT+x08Zey1zO9+1HvLt5YnMVLKZNfWICxW0xwJsrvOxccquxG F+CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TFcz7DZl; 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=pass (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 g17si14907785pgk.528.2021.10.18.06.59.30; Mon, 18 Oct 2021 06:59:43 -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=@linuxfoundation.org header.s=korg header.b=TFcz7DZl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234579AbhJROAd (ORCPT + 99 others); Mon, 18 Oct 2021 10:00:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:59334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234620AbhJRN6X (ORCPT ); Mon, 18 Oct 2021 09:58:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E3BD61A35; Mon, 18 Oct 2021 13:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564487; bh=woakGkc7RD5Tlnj94w8maMjglj3qeTr2P5jmvvbKFtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TFcz7DZlMJYWWv1md5/aQ+eyFId6Iwo7nT6ltg0QNtexoxwLDVOV1W+fXKB5UdPnn iAEZVvIVv5LzKQQ9W7Ow5mRIcNXaNsxbZa4IOsWmtatTKJ77rSFUVCSxyRZOZIGolC iWvWWoiFb8ISjJ5Yi+zBI81B2jlZot9a6DPCyHgo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Nuno=20S=C3=A1?= , Alexandru Ardelean , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.14 074/151] iio: adis16475: fix deadlock on frequency set Date: Mon, 18 Oct 2021 15:24:13 +0200 Message-Id: <20211018132343.097628795@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nuno Sá commit 9da1b86865ab4376408c58cd9fec332c8bdb5c73 upstream. With commit 39c024b51b560 ("iio: adis16475: improve sync scale mode handling"), two deadlocks were introduced: 1) The call to 'adis_write_reg_16()' was not changed to it's unlocked version. 2) The lock was not being released on the success path of the function. This change fixes both these issues. Fixes: 39c024b51b560 ("iio: adis16475: improve sync scale mode handling") Signed-off-by: Nuno Sá Reviewed-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20210920090047.74903-1-nuno.sa@analog.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/imu/adis16475.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/iio/imu/adis16475.c +++ b/drivers/iio/imu/adis16475.c @@ -353,10 +353,11 @@ static int adis16475_set_freq(struct adi if (dec > st->info->max_dec) dec = st->info->max_dec; - ret = adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec); + ret = __adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec); if (ret) goto error; + adis_dev_unlock(&st->adis); /* * If decimation is used, then gyro and accel data will have meaningful * bits on the LSB registers. This info is used on the trigger handler.