Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp729502ybt; Sat, 13 Jun 2020 20:40:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjlDBuK99Cc9mH50Ju3lUa118a5gRQRfoMvRtHXzSJcfbV2/WK7OTFHV5h7FXlMnjMnXIe X-Received: by 2002:a50:ba8b:: with SMTP id x11mr18511278ede.201.1592106005938; Sat, 13 Jun 2020 20:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592106005; cv=none; d=google.com; s=arc-20160816; b=AOFzz/DcporFMg/fpKBVnpbwizNuSarBqRm9YcLC4lXfrkTjPVWGKrSmoohchZeMMI DRotvxmu/Z6+j4Xks4dEP3C+Pu4GtQS1EepIMJA3XTQ78nYwNBDZw7R5vj7jANWSkkYx y40h7JEv63hQA9b/F65rHF4tPEzDdwc/IUSGiuChM3w/tcetOx2UYuDEw7+v8D8yZSG0 qovRovZ3tJgJlRIY3kd3Uz6PB2nErHF4uYJH8sb420l/HlvOalRzFYeuhYHPe+lVdSYJ 5+RV18+fMjyrBRoKiwHBgEdQGIbsAjuTGqUqy3fQPQpxiUSq8h/pCU2T+0nQxSxpxgLE UUYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:dmarc-filter; bh=IEXT8U99mfgcaOdzCXO1tyuVnx/v3mvO9nIAZY0Vi9A=; b=l+UGn2a4WkQS2uaaMB18CmRMnIS29q1tiHgiY5Nj6GUDs3GAYEABi2L6ejHmZIviIx JLe6qDSrevA9xiYJuQ67A66bdQXbLVu5rJe98wNq5XNub8R0//fAhLfBhl6INOx4Ae15 22R0eSy2ajxHulYs6d9dIgzT9GzZ/odUa0gx3UkhpR3eUIdLZacLiYlyXIGvH6uUAK8G UdcX1aopLwFFQdr1qCR8nPDITupt9aci6CbBgstFw9o4fsEuARROxA/kuopwXrNruoAi v4ArGVA0klFemThfYa7QTTKmnuFg62uaH1SsEW1k0JVP6VFgmBBCYcvK4WmzMl34aICx T+mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=LGu4gU9j; 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=QUARANTINE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qc28si6372415ejb.292.2020.06.13.20.39.43; Sat, 13 Jun 2020 20:40:05 -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=@umn.edu header.s=google header.b=LGu4gU9j; 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=QUARANTINE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726535AbgFNDh5 (ORCPT + 99 others); Sat, 13 Jun 2020 23:37:57 -0400 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:54714 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726460AbgFNDh5 (ORCPT ); Sat, 13 Jun 2020 23:37:57 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id 49l0Xh2pkyz9vYTw for ; Sun, 14 Jun 2020 03:37:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p6.oit.umn.edu ([127.0.0.1]) by localhost (mta-p6.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DAiKyY9yeOut for ; Sat, 13 Jun 2020 22:37:56 -0500 (CDT) Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p6.oit.umn.edu (Postfix) with ESMTPS id 49l0Xh180zz9vYTj for ; Sat, 13 Jun 2020 22:37:56 -0500 (CDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mta-p6.oit.umn.edu 49l0Xh180zz9vYTj DKIM-Filter: OpenDKIM Filter v2.11.0 mta-p6.oit.umn.edu 49l0Xh180zz9vYTj Received: by mail-il1-f198.google.com with SMTP id o12so9539588ilf.6 for ; Sat, 13 Jun 2020 20:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=IEXT8U99mfgcaOdzCXO1tyuVnx/v3mvO9nIAZY0Vi9A=; b=LGu4gU9jBSN6jiOgLF41ABPSsY/SbnVsxr7z9IYaoaFRSa+PwgUohjJtEcBpz0YquI vlvAhzT7q3EJefDVovTfAvEKoSA3LEHZjME9tIv1zzQuyrUAitpTSu2JMzm2RmaCxsrb uMimGbJPmVjbDStWXv9le/WaB6MzdbE31YruEjQiOP20nslrOHn3fgHA26itdNxlRmh0 rRvuuE0Jb3zV974QSZ3Nwfc1tFvOWwPyi8UAeqnVFm5bM7paFHLpFxlgEejUZL0dNfzl jw4MehN+jaPcLd1otPtLJ2j8VccfnoNzkWPuld3mku/oqw8aetUMdTEiZLjWlh+4hiis 1V3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=IEXT8U99mfgcaOdzCXO1tyuVnx/v3mvO9nIAZY0Vi9A=; b=OBpy9Tx9lgUfljzByYQaOpDESz4Sevghy2fBq80e/67g1hqmdW3v2Iq3rc9G9OmYQe jnMigFBEJ6LXnj5UY08AuwXK2dmV+JG27LmH90ntGaKzA9q+rRVRJUzmyGJetpsiQs0e VMeQuWPXyboUvlk0LyyxnAGbcP0FzGuu3RFvlCpUdT6dzyKU5kRoGUIkG+XkG6CJqAWi P2+3RquifMpwg5ffADn5LiVnLpa+mmjVtFaJ2RcJvjxrD1/8ZXjue52xNmyskNBhnq4a Hlt+yY0NaRAh6ICdnsPmGnFdp0KfXuxzCd8mwpVmJww9jP76sBWb2VAju+7J7mo+Eb7i BdDQ== X-Gm-Message-State: AOAM533xIhvnDNEoEowXwMLifa35xEgpUIjU2Lrzej2O4Djtc0DYguR7 5UsXBRvGFWjMuyN4mE+4D7c5d1zXZzViQviVy5exIPeyubmpoW/QApls95fprkEzLCAa5oU102i fskn3arBhbXowzQvnpII6NUqMd4WF X-Received: by 2002:a92:c103:: with SMTP id p3mr21158766ile.166.1592105875714; Sat, 13 Jun 2020 20:37:55 -0700 (PDT) X-Received: by 2002:a92:c103:: with SMTP id p3mr21158757ile.166.1592105875467; Sat, 13 Jun 2020 20:37:55 -0700 (PDT) Received: from qiushi.cs.umn.edu ([2607:ea00:101:3c74:4874:45:bcb4:df60]) by smtp.gmail.com with ESMTPSA id y13sm5607734iob.51.2020.06.13.20.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 20:37:54 -0700 (PDT) From: wu000273@umn.edu To: kjlu@umn.edu Cc: wu000273@umn.edu, Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: img: Fix a reference count leak in img_i2s_in_set_fmt Date: Sat, 13 Jun 2020 22:37:48 -0500 Message-Id: <20200614033749.2975-1-wu000273@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qiushi Wu pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code, causing incorrect ref count if pm_runtime_put_noidle() is not called in error handling paths. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails. Signed-off-by: Qiushi Wu --- sound/soc/img/img-i2s-in.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/img/img-i2s-in.c b/sound/soc/img/img-i2s-in.c index e30b66b94bf6..0843235d73c9 100644 --- a/sound/soc/img/img-i2s-in.c +++ b/sound/soc/img/img-i2s-in.c @@ -343,8 +343,10 @@ static int img_i2s_in_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) chan_control_mask = IMG_I2S_IN_CH_CTL_CLK_TRANS_MASK; ret = pm_runtime_get_sync(i2s->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(i2s->dev); return ret; + } for (i = 0; i < i2s->active_channels; i++) img_i2s_in_ch_disable(i2s, i); -- 2.17.1