]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: mpt3sas: Fix event callback log_code value handling
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Mon, 7 Mar 2022 23:48:53 +0000 (08:48 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 26 Apr 2022 02:30:04 +0000 (22:30 -0400)
In mpt3sas_scsih_event_callback(), fix a sparse warning when testing the
event log code value by replacing the use of a pointer to the address
storing the event log code with a log code local variable. Doing so,
le32_to_cpu() is used when the log code value is assigned, avoiding a
sparse warning.

Link: https://lore.kernel.org/r/20220307234854.148145-5-damien.lemoal@opensource.wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_scsih.c

index 7e476f50935b8bd86a3fdecd167aae099239dd27..6022875bc4a7e39e2a82b963ba42e93874c66d04 100644 (file)
@@ -10926,20 +10926,20 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
        case MPI2_EVENT_LOG_ENTRY_ADDED:
        {
                Mpi2EventDataLogEntryAdded_t *log_entry;
-               u32 *log_code;
+               u32 log_code;
 
                if (!ioc->is_warpdrive)
                        break;
 
                log_entry = (Mpi2EventDataLogEntryAdded_t *)
                    mpi_reply->EventData;
-               log_code = (u32 *)log_entry->LogData;
+               log_code = le32_to_cpu(*(__le32 *)log_entry->LogData);
 
                if (le16_to_cpu(log_entry->LogEntryQualifier)
                    != MPT2_WARPDRIVE_LOGENTRY)
                        break;
 
-               switch (le32_to_cpu(*log_code)) {
+               switch (log_code) {
                case MPT2_WARPDRIVE_LC_SSDT:
                        ioc_warn(ioc, "WarpDrive Warning: IO Throttling has occurred in the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n");
                        break;