From patchwork Fri Dec 13 10:48:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11290417 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AEEC6C1 for ; Fri, 13 Dec 2019 10:51:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB56C22527 for ; Fri, 13 Dec 2019 10:51:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="l3MvoCFU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbfLMKvD (ORCPT ); Fri, 13 Dec 2019 05:51:03 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:50070 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725747AbfLMKvD (ORCPT ); Fri, 13 Dec 2019 05:51:03 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xBDAgMld189322; Fri, 13 Dec 2019 10:50:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2019-08-05; bh=sEdwDE1EZ395BIdXjDm5b5a+AjIEteaEfG9Ui2sv2Rk=; b=l3MvoCFUL6ulk5RsD3zeyIMGkm5wXVgfgcbgRcMwkYn2WUVSVAEgXJpUJH3LLO4ppooO Q/xmVzSspSSl2C7EiSwFH/5wjf08X39l0wXrYguIU6i8dJ+me/pj3npDG4BfEBiqV67g js/JJFiFlPimqqhRmUM++7VjhXSvZ3xfm/ZsJawFVRlfY2lFOei2m8BJOqOVTzMgVJQM b1y0rebt+15EFo35u4RmfUXGotssMiKI4vx9o8epSKDBlMpcfpXOEW27hX/2x4IxLXPY lgPkY7GkB/3ZQDbL540qe1H6WGq+CZZEMjH4F+lPiV/YxjujvcUUOGuVRMTC9FhSSh6J Pg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 2wr41qremd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Dec 2019 10:50:45 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xBDAkiCD107556; Fri, 13 Dec 2019 10:48:44 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 2wumk8dyg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Dec 2019 10:48:44 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id xBDAmegM001404; Fri, 13 Dec 2019 10:48:40 GMT Received: from kili.mountain (/129.205.23.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Dec 2019 02:48:38 -0800 Date: Fri, 13 Dec 2019 13:48:28 +0300 From: Dan Carpenter To: Alim Akhtar , Bart Van Assche Cc: Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Bean Huo , Stanley Chu , Can Guo , Venkat Gopalakrishnan , Tomas Winkler , linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] scsi: ufs: Unlock on a couple error paths Message-ID: <20191213104828.7i64cpoof26rc4fw@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9469 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1912130086 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9469 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1912130086 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We introduced a few new error paths, but we can't return directly, we first have to unlock "hba->clk_scaling_lock" first. Fixes: a276c19e3e98 ("scsi: ufs: Avoid busy-waiting by eliminating tag conflicts") Signed-off-by: Dan Carpenter Reviewed-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e5cd57e68c46..bf981f0ea74c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2617,8 +2617,10 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, * the maximum wait time is bounded by SCSI request timeout. */ req = blk_get_request(q, REQ_OP_DRV_OUT, 0); - if (IS_ERR(req)) - return PTR_ERR(req); + if (IS_ERR(req)) { + err = PTR_ERR(req); + goto out_unlock; + } tag = req->tag; WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag)); @@ -2646,6 +2648,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, out_put_tag: blk_put_request(req); +out_unlock: up_read(&hba->clk_scaling_lock); return err; } @@ -5854,8 +5857,10 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, down_read(&hba->clk_scaling_lock); req = blk_get_request(q, REQ_OP_DRV_OUT, 0); - if (IS_ERR(req)) - return PTR_ERR(req); + if (IS_ERR(req)) { + err = PTR_ERR(req); + goto out_unlock; + } tag = req->tag; WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag)); @@ -5934,6 +5939,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, } blk_put_request(req); +out_unlock: up_read(&hba->clk_scaling_lock); return err; }