git: 94fe3a527eb2 - stable/13 - nvmecontrol: Fix condition when print number of Firmware Slots and Firmware Slot1 Readonly.

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Wed, 23 Nov 2022 09:44:05 UTC
The branch stable/13 has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=94fe3a527eb2f0f02ad40c1c9464a454344ae4d5

commit 94fe3a527eb2f0f02ad40c1c9464a454344ae4d5
Author:     Wanpeng Qian <wanpengqian@gmail.com>
AuthorDate: 2022-11-14 12:59:11 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2022-11-22 06:51:48 +0000

    nvmecontrol: Fix condition when print number of Firmware Slots and Firmware Slot1 Readonly.
    
    The Number of Firmware Slots should never be zero. So, a Firmware Slot 1
    should always exist. For that reason, always print the Number of
    Firmware Slots and the Firmware Slot 1 Read-Only value.
    
    Reviewed by:            imp
    Approved by:            manu (mentor)
    MFC after:              1 week
    Differential Revision:  https://reviews.freebsd.org/D34700
    
    (cherry picked from commit 0fd43b0c6a76d7be4d9673837a7d7099b6a29ace)
---
 sbin/nvmecontrol/identify_ext.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/sbin/nvmecontrol/identify_ext.c b/sbin/nvmecontrol/identify_ext.c
index 311c8cba09a9..272946d319d4 100644
--- a/sbin/nvmecontrol/identify_ext.c
+++ b/sbin/nvmecontrol/identify_ext.c
@@ -172,16 +172,8 @@ nvme_print_controller(struct nvme_controller_data *cdata)
 	}
 	printf("Abort Command Limit:         %d\n", cdata->acl+1);
 	printf("Async Event Request Limit:   %d\n", cdata->aerl+1);
-	printf("Number of Firmware Slots:    ");
-	if (fw != 0)
-		printf("%d\n", fw_num_slots);
-	else
-		printf("N/A\n");
-	printf("Firmware Slot 1 Read-Only:   ");
-	if (fw != 0)
-		printf("%s\n", fw_slot1_ro ? "Yes" : "No");
-	else
-		printf("N/A\n");
+	printf("Number of Firmware Slots:    %d\n", fw_num_slots);
+	printf("Firmware Slot 1 Read-Only:   %s\n", fw_slot1_ro ? "Yes" : "No");
 	printf("Per-Namespace SMART Log:     %s\n",
 		ns_smart ? "Yes" : "No");
 	printf("Error Log Page Entries:      %d\n", cdata->elpe+1);