From patchwork Thu Nov 24 00:32:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: subhashj@codeaurora.org X-Patchwork-Id: 9444555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2638A6075F for ; Thu, 24 Nov 2016 00:33:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2427927E5A for ; Thu, 24 Nov 2016 00:33:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17D0427F17; Thu, 24 Nov 2016 00:33:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EECD27E5A for ; Thu, 24 Nov 2016 00:33:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935925AbcKXAdF (ORCPT ); Wed, 23 Nov 2016 19:33:05 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:51742 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934917AbcKXAdD (ORCPT ); Wed, 23 Nov 2016 19:33:03 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B50F96155C; Thu, 24 Nov 2016 00:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1479947582; bh=1TzvTR7OpB3nRWcz/3iht1H4x2KLmZSCSx9rmhYL9gc=; h=From:To:Cc:Subject:Date:From; b=kzAr6WCzsl5S8BXiU7SPm+1LU2sRDVn8RB3jH+zz0L72UhJyVhhx0YrzF1Rwiadae Oo6/WCfNVF1SO2lQ5bQaUg/qBmGmzNtaHOqLGtDZR0KBcvvIlT+bAxdzUo1fV7103e DI9x4Tf0O5oOHjxMRwcfkk9kQpLlCwifT8acE+C4= Received: from subhashj-linux1.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: subhashj@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 24185614A1; Thu, 24 Nov 2016 00:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1479947582; bh=1TzvTR7OpB3nRWcz/3iht1H4x2KLmZSCSx9rmhYL9gc=; h=From:To:Cc:Subject:Date:From; b=kzAr6WCzsl5S8BXiU7SPm+1LU2sRDVn8RB3jH+zz0L72UhJyVhhx0YrzF1Rwiadae Oo6/WCfNVF1SO2lQ5bQaUg/qBmGmzNtaHOqLGtDZR0KBcvvIlT+bAxdzUo1fV7103e DI9x4Tf0O5oOHjxMRwcfkk9kQpLlCwifT8acE+C4= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org 24185614A1 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=subhashj@codeaurora.org From: Subhash Jadavani To: vinholikatti@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: Yaniv Gardi , Subhash Jadavani , linux-scsi@vger.kernel.org (open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 09/11] scsi: ufs: fix condition in which DME command failure msg is printed out Date: Wed, 23 Nov 2016 16:32:49 -0800 Message-Id: <1479947569-7256-1-git-send-email-subhashj@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yaniv Gardi The condition in which error message is printed out was incorrect and resulted error message only if retries exhausted. But retries happens only if DME command is a peer command, and thus DME commands which are not peer commands and fail are not printed out. This change fixes this issue. Signed-off-by: Yaniv Gardi Signed-off-by: Subhash Jadavani --- drivers/scsi/ufs/ufshcd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index ec4c99a..b826078 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2516,10 +2516,10 @@ int ufshcd_dme_set_attr(struct ufs_hba *hba, u32 attr_sel, set, UIC_GET_ATTR_ID(attr_sel), mib_val, ret); } while (ret && peer && --retries); - if (!retries) + if (ret) dev_err(hba->dev, "%s: attr-id 0x%x val 0x%x failed %d retries\n", - set, UIC_GET_ATTR_ID(attr_sel), mib_val, - retries); + set, UIC_GET_ATTR_ID(attr_sel), mib_val, + UFS_UIC_COMMAND_RETRIES - retries); return ret; } @@ -2583,9 +2583,10 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel, get, UIC_GET_ATTR_ID(attr_sel), ret); } while (ret && peer && --retries); - if (!retries) + if (ret) dev_err(hba->dev, "%s: attr-id 0x%x failed %d retries\n", - get, UIC_GET_ATTR_ID(attr_sel), retries); + get, UIC_GET_ATTR_ID(attr_sel), + UFS_UIC_COMMAND_RETRIES - retries); if (mib_val && !ret) *mib_val = uic_cmd.argument3;