From patchwork Tue Jun 23 19:57:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223260 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=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 DDAEAC433E0 for ; Tue, 23 Jun 2020 21:10:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD469204EA for ; Tue, 23 Jun 2020 21:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592946655; bh=6XFOWRwqP51ncHyM1K4Bi9eh6F1DgMWmP/TQ/75CFAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Hbwg68QOa2sikFx3ZAFFKTJW6J/+0Bp+8YVeXimhXVak3aTAxaj/2ZGoE27kmiI1F Kfa/lNB19akZlhkMIHF5i118RvWmi3wcj985zuyloGyDKWUj2Q6Ecsfl//jaShDgow qo3qm93c7v03CS3B5/2GVEaW/2s2XSDEyTcXWIlo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391836AbgFWVKy (ORCPT ); Tue, 23 Jun 2020 17:10:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:53626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391343AbgFWUck (ORCPT ); Tue, 23 Jun 2020 16:32:40 -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 605A42064B; Tue, 23 Jun 2020 20:32:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944360; bh=6XFOWRwqP51ncHyM1K4Bi9eh6F1DgMWmP/TQ/75CFAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H15HTdQ5+xFUpF4fbyjH3KSuJwpJVCUXJI8/ifxmH5aBj0LF9frtHok9z2I49sQNM Gqu60+hc0ALm8OmWELMBQV3v8HnxlHyZQ21RWDoVfKQ26jNfUii+1GuXEslD+pHSNM 9p0Ngos69aSCYLWeBY1O+yCjFa2e1EpqdStDI+uw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avri Altman , Dinghao Liu , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.4 275/314] scsi: ufs-bsg: Fix runtime PM imbalance on error Date: Tue, 23 Jun 2020 21:57:50 +0200 Message-Id: <20200623195352.102621485@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu [ Upstream commit a1e17eb03e69bb61bd1b1a14610436b7b9be12d9 ] When ufs_bsg_alloc_desc_buffer() returns an error code, a pairing runtime PM usage counter decrement is needed to keep the counter balanced. Link: https://lore.kernel.org/r/20200522045932.31795-1-dinghao.liu@zju.edu.cn Fixes: 74e5e468b664 (scsi: ufs-bsg: Wake the device before sending raw upiu commands) Reviewed-by: Avri Altman Signed-off-by: Dinghao Liu Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufs_bsg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs_bsg.c b/drivers/scsi/ufs/ufs_bsg.c index d2197a31abe58..bad366e491591 100644 --- a/drivers/scsi/ufs/ufs_bsg.c +++ b/drivers/scsi/ufs/ufs_bsg.c @@ -106,8 +106,10 @@ static int ufs_bsg_request(struct bsg_job *job) desc_op = bsg_request->upiu_req.qr.opcode; ret = ufs_bsg_alloc_desc_buffer(hba, job, &desc_buff, &desc_len, desc_op); - if (ret) + if (ret) { + pm_runtime_put_sync(hba->dev); goto out; + } /* fall through */ case UPIU_TRANSACTION_NOP_OUT: