scsi: target: iscsi: Fix an error message in iscsi_check_key()
authorMaurizio Lombardi <mlombard@redhat.com>
Tue, 14 Feb 2023 14:15:56 +0000 (15:15 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 6 Mar 2023 21:50:42 +0000 (16:50 -0500)
The first half of the error message is printed by pr_err(), the second half
is printed by pr_debug(). The user will therefore see only the first part
of the message and will miss some useful information.

Link: https://lore.kernel.org/r/20230214141556.762047-1-mlombard@redhat.com
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/iscsi/iscsi_target_parameters.c

index 2317fb077db0eb70e59b619d7ede6337b7bc919b..557516c642c3b037e8ffd04393c24b0b37e4a27e 100644 (file)
@@ -1262,18 +1262,20 @@ static struct iscsi_param *iscsi_check_key(
                return param;
 
        if (!(param->phase & phase)) {
-               pr_err("Key \"%s\" may not be negotiated during ",
-                               param->name);
+               char *phase_name;
+
                switch (phase) {
                case PHASE_SECURITY:
-                       pr_debug("Security phase.\n");
+                       phase_name = "Security";
                        break;
                case PHASE_OPERATIONAL:
-                       pr_debug("Operational phase.\n");
+                       phase_name = "Operational";
                        break;
                default:
-                       pr_debug("Unknown phase.\n");
+                       phase_name = "Unknown";
                }
+               pr_err("Key \"%s\" may not be negotiated during %s phase.\n",
+                               param->name, phase_name);
                return NULL;
        }