Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752065AbdIVKb7 (ORCPT ); Fri, 22 Sep 2017 06:31:59 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36081 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751872AbdIVKb5 (ORCPT ); Fri, 22 Sep 2017 06:31:57 -0400 X-Google-Smtp-Source: AOwi7QDqPJh4ExZUbBFvp43TVDF8K3p88Hmf6bH/tUyc+3Zoid2dD0pIPSuGFQggliqFHG8TpXfTeQ== From: Huanlin Ke X-Google-Original-From: Huanlin Ke To: vinholikatti@gmail.com Cc: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kehuanlin@pinecone.net Subject: [PATCH] scsi: ufs: continue to boot even with Boot LUN is disabled Date: Fri, 22 Sep 2017 18:31:47 +0800 Message-Id: <1506076307-8462-1-git-send-email-kehuanlin@pinecone.net> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1707 Lines: 54 Several configurable fields of the Device Descriptor and the Unit Descriptors determine the Boot LUN status. The bBootEnable field and the bBootLunEn attribute is set to zero by default, so the Boot LUN is disabled by default. At which point the scsi device add for Boot LUN will fail, but we can continue to use the ufs device in fact. This failure shouldn't abort the device boot. Signed-off-by: Huanlin Ke --- drivers/scsi/ufs/ufshcd.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 794a460..bff84be 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5998,25 +5998,22 @@ static int ufshcd_scsi_add_wlus(struct ufs_hba *hba) } scsi_device_put(hba->sdev_ufs_device); - sdev_boot = __scsi_add_device(hba->host, 0, 0, - ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); - if (IS_ERR(sdev_boot)) { - ret = PTR_ERR(sdev_boot); - goto remove_sdev_ufs_device; - } - scsi_device_put(sdev_boot); - sdev_rpmb = __scsi_add_device(hba->host, 0, 0, ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_RPMB_WLUN), NULL); if (IS_ERR(sdev_rpmb)) { ret = PTR_ERR(sdev_rpmb); - goto remove_sdev_boot; + goto remove_sdev_ufs_device; } scsi_device_put(sdev_rpmb); + + sdev_boot = __scsi_add_device(hba->host, 0, 0, + ufshcd_upiu_wlun_to_scsi_wlun(UFS_UPIU_BOOT_WLUN), NULL); + if (IS_ERR(sdev_boot)) + dev_err(hba->dev, "%s: BOOT WLUN not found\n", __func__); + else + scsi_device_put(sdev_boot); goto out; -remove_sdev_boot: - scsi_remove_device(sdev_boot); remove_sdev_ufs_device: scsi_remove_device(hba->sdev_ufs_device); out: -- 2.7.4