From patchwork Wed Jul 12 04:22:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Bur X-Patchwork-Id: 786996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x6mW62fjNz9s7F for ; Wed, 12 Jul 2017 14:41:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MviNJnBq"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="Ahuv2bsQ"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id: References:In-Reply-To:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Jo44ic7OK/CBSNU1QReAs3c7oDhcXMMPQ0lxgyQ3kNI=; b=MviNJnBqz3vFn/kiovQEMEObJA zp94eyfOTOpdCVRgDZff8zLenq+jYKf3Nwoiu2vnBrsAgkNanFU6w3R5kU0A0AJyqkxepwV15IcYe 9F8KGo9U39/XVQycDUZoXbz/0qFDWtZzGPaJ1cIWPBLX96PbP84U44Gx0qLFpA57Opi+WClnaS4nf 9jQBZeqL0DcSm+wzbJvPTbn2VBJtA0GOAe1Vz8tcsQg9G3Hw+2bBJGzSkMhJasykjNhP/Dh4PgEGI eyoLuvqKykrG/3OySbim7bqbFzIwHtkqIvL2aWSUraU/266EuKIFrJQBJKVkjap0xJDUORMvZA/Qm IQUze3WA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dV9Sp-0000no-CB; Wed, 12 Jul 2017 04:41:27 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dV9Sm-0000kz-UU for linux-mtd@bombadil.infradead.org; Wed, 12 Jul 2017 04:41:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Message-Id:References:In-Reply-To:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rHCRrLvLURYe0fexkZVS3GZjYQxwopgyj2TDCcUojVY=; b=Ahuv2bsQKsuVTmoiy+uRVXbkV hu91mfimya4B7SqtnkdhP2z0pmUnxA6yilgKn7QR2DTdXIoAIfPErC6dLwGcnH9glywpS5S6+yz1P czaP3HZTdSeAdl/skvFo2AidVz3VOpA2tji8EW/Q0nHYYXbF4UmKIWgKI6tXVQWi8qmnhNT/rR5sb aawPsJi5AtY9zaYTT9DjL8l7QV4/M8i9gbPSgEHG8mvXpbhuTvUAUXz1pSU22DsLZ0qt9QZL6lg0y SJYSkVv+40WbSHiX+Oec6QeX/mO+x5jTCYroTRBJTeo6JUnbl82WPZz7+8vM4NUNilpShaOch8asu EVPlp+e2Q==; Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5] helo=mx0a-001b2d01.pphosted.com) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dV9E0-0007Fo-Qy for linux-mtd@lists.infradead.org; Wed, 12 Jul 2017 04:26:10 +0000 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6C4NmVA038640 for ; Wed, 12 Jul 2017 00:25:47 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0b-001b2d01.pphosted.com with ESMTP id 2bncj4rakv-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 12 Jul 2017 00:25:47 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Jul 2017 14:25:44 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 12 Jul 2017 14:25:43 +1000 Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6C4OJlQ13631532 for ; Wed, 12 Jul 2017 14:24:27 +1000 Received: from d23av05.au.ibm.com (localhost [127.0.0.1]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v6C4Ntnd009199 for ; Wed, 12 Jul 2017 14:23:55 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v6C4NsBl008665; Wed, 12 Jul 2017 14:23:54 +1000 Received: from camb691.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 8F939A037C; Wed, 12 Jul 2017 14:23:30 +1000 (AEST) From: Cyril Bur To: linuxppc-dev@lists.ozlabs.org, linux-mtd@lists.infradead.org Subject: [PATCH v3 03/10] mtd: powernv_flash: Don't treat OPAL_SUCCESS as an error Date: Wed, 12 Jul 2017 14:22:57 +1000 X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170712042304.19745-1-cyrilbur@gmail.com> References: <20170712042304.19745-1-cyrilbur@gmail.com> X-TM-AS-MML: disable x-cbid: 17071204-0040-0000-0000-000003463681 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071204-0041-0000-0000-00000CC1AFA7 Message-Id: <20170712042304.19745-4-cyrilbur@gmail.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-11_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707120068 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170712_052609_063607_3EAE3301 X-CRM114-Status: GOOD ( 15.68 ) X-Spam-Score: -3.8 (---) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-3.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.8 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [148.163.158.5 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [148.163.158.5 listed in list.dnswl.org] 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (cyrilbur[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stewart@linux.vnet.ibm.com, benh@kernel.crashing.org, alistair@popple.id.au, dwmw2@infradead.org, rlippert@google.com MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org While this driver expects to interact asynchronously, OPAL is well within its rights to return OPAL_SUCCESS to indicate that the operation completed without the need for a callback. We shouldn't treat OPAL_SUCCESS as an error rather we should wrap up and return promptly to the caller. Signed-off-by: Cyril Bur --- I'll note here that currently no OPAL exists that will return OPAL_SUCCESS so there isn't the possibility of a bug today. drivers/mtd/devices/powernv_flash.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c index 7b41af06f4fe..d50b5f200f73 100644 --- a/drivers/mtd/devices/powernv_flash.c +++ b/drivers/mtd/devices/powernv_flash.c @@ -66,9 +66,8 @@ static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op, if (token < 0) { if (token != -ERESTARTSYS) dev_err(dev, "Failed to get an async token\n"); - - rc = token; - goto out; + mutex_unlock(&info->lock); + return token; } switch (op) { @@ -87,23 +86,25 @@ static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op, goto out; } + if (rc == OPAL_SUCCESS) + goto out_success; + if (rc != OPAL_ASYNC_COMPLETION) { dev_err(dev, "opal_flash_async_op(op=%d) failed (rc %d)\n", op, rc); - opal_async_release_token(token); rc = -EIO; goto out; } rc = opal_async_wait_response(token, &msg); - opal_async_release_token(token); - mutex_unlock(&info->lock); if (rc) { dev_err(dev, "opal async wait failed (rc %d)\n", rc); - return -EIO; + rc = -EIO; + goto out; } rc = opal_get_async_rc(msg); +out_success: if (rc == OPAL_SUCCESS) { rc = 0; if (retlen) @@ -112,8 +113,8 @@ static int powernv_flash_async_op(struct mtd_info *mtd, enum flash_op op, rc = -EIO; } - return rc; out: + opal_async_release_token(token); mutex_unlock(&info->lock); return rc; }