From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5161AC11F6D for ; Mon, 12 Jul 2021 08:52:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A1B3610CD for ; Mon, 12 Jul 2021 08:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355948AbhGLIyk (ORCPT ); Mon, 12 Jul 2021 04:54:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:55668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353628AbhGLICi (ORCPT ); Mon, 12 Jul 2021 04:02:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCDA46141A; Mon, 12 Jul 2021 07:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626076559; bh=ltdWVT6jllalnp0WWQxqbavgaYqE5bB1QLzV0T48/Z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2/vrDR0z+m+DuCJvxuRhzY8wV+gNN5bL1DTx+Q1z4w6jMjb3G8W4RY4RqB+7G795 yju+qsp5Y7tGWul+Thgm/1j53LOC50tiahwIImPog96mSmJx+zy76ZXGUXq0JpEdqJ NO9LNSxo4iI8AK6X/DPiZCbM9d5HxWz3+/d2btqA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bard Liao , Oder Chiou , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.13 694/800] ASoC: rt5682: Fix a problem with error handling in the io init function of the soundwire Date: Mon, 12 Jul 2021 08:11:57 +0200 Message-Id: <20210712061040.681497300@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060912.995381202@linuxfoundation.org> References: <20210712060912.995381202@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: Oder Chiou [ Upstream commit 9266d95405ae0c078f188ec8bca3a004631be429 ] The device checking error should be a jump to pm_runtime_put_autosuspend() as done before returning value. Fixes: 867f8d18df4f ('ASoC: rt5682: fix getting the wrong device id when the suspend_stress_test') Reviewed-by: Bard Liao Signed-off-by: Oder Chiou Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20210607222239.582139-13-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt5682-sdw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt5682-sdw.c b/sound/soc/codecs/rt5682-sdw.c index 8e4bb9dd194e..529a85fd0a00 100644 --- a/sound/soc/codecs/rt5682-sdw.c +++ b/sound/soc/codecs/rt5682-sdw.c @@ -408,9 +408,11 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave) usleep_range(30000, 30005); loop--; } + if (val != DEVICE_ID) { dev_err(dev, "Device with ID register %x is not rt5682\n", val); - return -ENODEV; + ret = -ENODEV; + goto err_nodev; } if (rt5682->first_hw_init) { @@ -486,10 +488,11 @@ reinit: rt5682->hw_init = true; rt5682->first_hw_init = true; +err_nodev: pm_runtime_mark_last_busy(&slave->dev); pm_runtime_put_autosuspend(&slave->dev); - dev_dbg(&slave->dev, "%s hw_init complete\n", __func__); + dev_dbg(&slave->dev, "%s hw_init complete: %d\n", __func__, ret); return ret; } -- 2.30.2