2022-03-15 08:52:48

by Paul Menzel

[permalink] [raw]
Subject: [PATCH] scsi: 3w-sas: Correct log level of several messages

On a Dell PowerEdge T630, Linux logs some 3w-sas warnings:

$ dmesg | grep DMI:
[ 0.000000] DMI: Dell Inc. PowerEdge T630/0W9WXC, BIOS 2.5.4 08/17/2017
$ dmesg --level=warn | grep 3w
[ 22.449617] 3w-sas: scsi12: AEN: INFO (0x04:0x0053): Battery capacity test is overdue:.
[ 22.680618] 3w-sas: scsi12: Found an LSI 3ware 9750-8e Controller at 0xc8040000, IRQ: 117.
[ 23.001611] 3w-sas: scsi12: Firmware FH9X 5.12.00.016, BIOS BE9X 5.11.00.007, Phys: 8.

These are obviously no warnings, and just informational messages. Look
through the file, and adapt the log level of several messages mostly
according to the level string in the message.

The message below is the only tricky change, as the log level actually
depends on the AEN severity determined by `twl_aen_severity_lookup()`.

printk(KERN_INFO "3w-sas:%s AEN: %s (0x%02X:0x%04X): %s:%s.\n",
host,
twl_aen_severity_lookup(TW_SEV_OUT(header->status_block.severity__reserved)),
TW_MESSAGE_SOURCE_CONTROLLER_EVENT, aen, error_str,
header->err_specific_desc);

The AEN severity levels below exist.

/* AEN severity table */
static char *twl_aen_severity_table[] =
{
"None", "ERROR", "WARNING", "INFO", "DEBUG", NULL
};

It’s demoted from a warning to an informational message nevertheless to
avoid adding if-else statements.

Signed-off-by: Paul Menzel <[email protected]>
---
drivers/scsi/3w-sas.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 3ebe66151dcb..378be2c57fc5 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -256,7 +256,7 @@ static void twl_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_H
event->parameter_len = strlen(header->err_specific_desc);
memcpy(event->parameter_data, header->err_specific_desc, event->parameter_len + 1 + strlen(error_str));
if (event->severity != TW_AEN_SEVERITY_DEBUG)
- printk(KERN_WARNING "3w-sas:%s AEN: %s (0x%02X:0x%04X): %s:%s.\n",
+ printk(KERN_INFO "3w-sas:%s AEN: %s (0x%02X:0x%04X): %s:%s.\n",
host,
twl_aen_severity_lookup(TW_SEV_OUT(header->status_block.severity__reserved)),
TW_MESSAGE_SOURCE_CONTROLLER_EVENT, aen, error_str,
@@ -873,14 +873,14 @@ static int twl_fill_sense(TW_Device_Extension *tw_dev, int i, int request_id, in
error = le16_to_cpu(header->status_block.error);
if ((error != TW_ERROR_LOGICAL_UNIT_NOT_SUPPORTED) && (error != TW_ERROR_UNIT_OFFLINE) && (error != TW_ERROR_INVALID_FIELD_IN_CDB)) {
if (print_host)
- printk(KERN_WARNING "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
+ printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
tw_dev->host->host_no,
TW_MESSAGE_SOURCE_CONTROLLER_ERROR,
header->status_block.error,
error_str,
header->err_specific_desc);
else
- printk(KERN_WARNING "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
+ printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
TW_MESSAGE_SOURCE_CONTROLLER_ERROR,
header->status_block.error,
error_str,
@@ -1493,13 +1493,13 @@ static void __twl_shutdown(TW_Device_Extension *tw_dev)
/* Free up the IRQ */
free_irq(tw_dev->tw_pci_dev->irq, tw_dev);

- printk(KERN_WARNING "3w-sas: Shutting down host %d.\n", tw_dev->host->host_no);
+ printk(KERN_INFO "3w-sas: Shutting down host %d.\n", tw_dev->host->host_no);

/* Tell the card we are shutting down */
if (twl_initconnection(tw_dev, 1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x16, "Connection shutdown failed");
} else {
- printk(KERN_WARNING "3w-sas: Shutdown complete.\n");
+ printk(KERN_INFO "3w-sas: Shutdown complete.\n");
}

/* Clear doorbell interrupt just before exit */
@@ -1631,7 +1631,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)

pci_set_drvdata(pdev, host);

- printk(KERN_WARNING "3w-sas: scsi%d: Found an LSI 3ware %s Controller at 0x%llx, IRQ: %d.\n",
+ printk(KERN_INFO "3w-sas: scsi%d: Found an LSI 3ware %s Controller at 0x%llx, IRQ: %d.\n",
host->host_no,
(char *)twl_get_param(tw_dev, 1, TW_VERSION_TABLE,
TW_PARAM_MODEL, TW_PARAM_MODEL_LENGTH),
@@ -1642,7 +1642,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
if (ptr_phycount)
phycount = le32_to_cpu(*(int *)ptr_phycount);

- printk(KERN_WARNING "3w-sas: scsi%d: Firmware %s, BIOS %s, Phys: %d.\n",
+ printk(KERN_INFO "3w-sas: scsi%d: Firmware %s, BIOS %s, Phys: %d.\n",
host->host_no,
(char *)twl_get_param(tw_dev, 1, TW_VERSION_TABLE,
TW_PARAM_FWVER, TW_PARAM_FWVER_LENGTH),
@@ -1753,7 +1753,7 @@ static int __maybe_unused twl_suspend(struct device *dev)
struct Scsi_Host *host = dev_get_drvdata(dev);
TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata;

- printk(KERN_WARNING "3w-sas: Suspending host %d.\n", tw_dev->host->host_no);
+ printk(KERN_INFO "3w-sas: Suspending host %d.\n", tw_dev->host->host_no);
/* Disable interrupts */
TWL_MASK_INTERRUPTS(tw_dev);

@@ -1763,7 +1763,7 @@ static int __maybe_unused twl_suspend(struct device *dev)
if (twl_initconnection(tw_dev, 1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL)) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x23, "Connection shutdown failed during suspend");
} else {
- printk(KERN_WARNING "3w-sas: Suspend complete.\n");
+ printk(KERN_INFO "3w-sas: Suspend complete.\n");
}

/* Clear doorbell interrupt */
@@ -1780,7 +1780,7 @@ static int __maybe_unused twl_resume(struct device *dev)
struct Scsi_Host *host = pci_get_drvdata(pdev);
TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata;

- printk(KERN_WARNING "3w-sas: Resuming host %d.\n", tw_dev->host->host_no);
+ printk(KERN_INFO "3w-sas: Resuming host %d.\n", tw_dev->host->host_no);
pci_try_set_mwi(pdev);

retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
@@ -1811,7 +1811,7 @@ static int __maybe_unused twl_resume(struct device *dev)
/* Re-enable interrupts on the card */
TWL_UNMASK_INTERRUPTS(tw_dev);

- printk(KERN_WARNING "3w-sas: Resume complete.\n");
+ printk(KERN_INFO "3w-sas: Resume complete.\n");
return 0;

out_disable_device:
--
2.35.1


2022-03-16 00:02:39

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] scsi: 3w-sas: Correct log level of several messages

Hi Paul,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next v5.17-rc8 next-20220310]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Paul-Menzel/scsi-3w-sas-Correct-log-level-of-several-messages/20220315-035918
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220315/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 3e4950d7fa78ac83f33bbf1658e2f49a73719236)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/8d5baa500eb6500560660c4c5c355f9556cc4a51
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Paul-Menzel/scsi-3w-sas-Correct-log-level-of-several-messages/20220315-035918
git checkout 8d5baa500eb6500560660c4c5c355f9556cc4a51
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/scsi/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/scsi/3w-sas.c:876:11: error: use of undeclared identifier 'KERN_ERROR'; did you mean 'KERN_PROF'?
printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
^~~~~~~~~~
KERN_PROF
include/linux/printk.h:446:53: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^
include/linux/printk.h:418:11: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
^
include/uapi/linux/sysctl.h:90:2: note: 'KERN_PROF' declared here
KERN_PROF=6, /* table: profiling information */
^
drivers/scsi/3w-sas.c:883:11: error: use of undeclared identifier 'KERN_ERROR'; did you mean 'KERN_PROF'?
printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
^~~~~~~~~~
KERN_PROF
include/linux/printk.h:446:53: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^
include/linux/printk.h:418:11: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
^
include/uapi/linux/sysctl.h:90:2: note: 'KERN_PROF' declared here
KERN_PROF=6, /* table: profiling information */
^
drivers/scsi/3w-sas.c:1569:49: warning: shift count >= width of type [-Wshift-count-overflow]
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
drivers/scsi/3w-sas.c:1786:49: warning: shift count >= width of type [-Wshift-count-overflow]
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
2 warnings and 2 errors generated.


vim +876 drivers/scsi/3w-sas.c

857
858 /* This function passes sense data from firmware to scsi layer */
859 static int twl_fill_sense(TW_Device_Extension *tw_dev, int i, int request_id, int copy_sense, int print_host)
860 {
861 TW_Command_Apache_Header *header;
862 TW_Command_Full *full_command_packet;
863 unsigned short error;
864 char *error_str;
865
866 header = tw_dev->sense_buffer_virt[i];
867 full_command_packet = tw_dev->command_packet_virt[request_id];
868
869 /* Get embedded firmware error string */
870 error_str = &(header->err_specific_desc[strlen(header->err_specific_desc) + 1]);
871
872 /* Don't print error for Logical unit not supported during rollcall */
873 error = le16_to_cpu(header->status_block.error);
874 if ((error != TW_ERROR_LOGICAL_UNIT_NOT_SUPPORTED) && (error != TW_ERROR_UNIT_OFFLINE) && (error != TW_ERROR_INVALID_FIELD_IN_CDB)) {
875 if (print_host)
> 876 printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
877 tw_dev->host->host_no,
878 TW_MESSAGE_SOURCE_CONTROLLER_ERROR,
879 header->status_block.error,
880 error_str,
881 header->err_specific_desc);
882 else
883 printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
884 TW_MESSAGE_SOURCE_CONTROLLER_ERROR,
885 header->status_block.error,
886 error_str,
887 header->err_specific_desc);
888 }
889
890 if (copy_sense) {
891 memcpy(tw_dev->srb[request_id]->sense_buffer, header->sense_data, TW_SENSE_DATA_LENGTH);
892 tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1);
893 goto out;
894 }
895 out:
896 return 1;
897 } /* End twl_fill_sense() */
898

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/[email protected]

2022-03-17 01:35:58

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] scsi: 3w-sas: Correct log level of several messages

Hi Paul,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on jejb-scsi/for-next]
[also build test ERROR on mkp-scsi/for-next v5.17-rc8 next-20220310]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Paul-Menzel/scsi-3w-sas-Correct-log-level-of-several-messages/20220315-035918
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-randconfig-a004-20220314 (https://download.01.org/0day-ci/archive/20220315/[email protected]/config)
compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/8d5baa500eb6500560660c4c5c355f9556cc4a51
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Paul-Menzel/scsi-3w-sas-Correct-log-level-of-several-messages/20220315-035918
git checkout 8d5baa500eb6500560660c4c5c355f9556cc4a51
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/scsi/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:29,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/current.h:6,
from arch/x86/include/asm/processor.h:17,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:65,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/scsi/3w-sas.c:53:
drivers/scsi/3w-sas.c: In function 'twl_fill_sense':
>> drivers/scsi/3w-sas.c:876:11: error: 'KERN_ERROR' undeclared (first use in this function); did you mean 'KERN_ERR'?
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~
include/linux/printk.h:370:28: note: in definition of macro '__printk_index_emit'
370 | if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
| ^~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:876:4: note: in expansion of macro 'printk'
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
drivers/scsi/3w-sas.c:876:11: note: each undeclared identifier is reported only once for each function it appears in
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~
include/linux/printk.h:370:28: note: in definition of macro '__printk_index_emit'
370 | if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
| ^~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:876:4: note: in expansion of macro 'printk'
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
>> drivers/scsi/3w-sas.c:876:22: error: expected ')' before string constant
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:370:28: note: in definition of macro '__printk_index_emit'
370 | if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
| ^~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:876:4: note: in expansion of macro 'printk'
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
In file included from include/linux/kernel.h:29,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/current.h:6,
from arch/x86/include/asm/processor.h:17,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:65,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/scsi/3w-sas.c:53:
>> drivers/scsi/3w-sas.c:876:22: error: expected ')' before string constant
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:379:33: note: in definition of macro '__printk_index_emit'
379 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:876:4: note: in expansion of macro 'printk'
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
>> drivers/scsi/3w-sas.c:876:22: error: expected ')' before string constant
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:379:42: note: in definition of macro '__printk_index_emit'
379 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:876:4: note: in expansion of macro 'printk'
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
include/linux/printk.h:379:41: note: to match this '('
379 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^
include/linux/printk.h:417:3: note: in expansion of macro '__printk_index_emit'
417 | __printk_index_emit(_fmt, NULL, NULL); \
| ^~~~~~~~~~~~~~~~~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:876:4: note: in expansion of macro 'printk'
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
>> drivers/scsi/3w-sas.c:876:22: error: expected ')' before string constant
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:418:11: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
drivers/scsi/3w-sas.c:876:4: note: in expansion of macro 'printk'
876 | printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
In file included from include/linux/kernel.h:29,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/current.h:6,
from arch/x86/include/asm/processor.h:17,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:65,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/scsi/3w-sas.c:53:
drivers/scsi/3w-sas.c:883:22: error: expected ')' before string constant
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:370:28: note: in definition of macro '__printk_index_emit'
370 | if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
| ^~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:883:4: note: in expansion of macro 'printk'
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
In file included from include/linux/kernel.h:29,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/current.h:6,
from arch/x86/include/asm/processor.h:17,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:65,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/scsi/3w-sas.c:53:
drivers/scsi/3w-sas.c:883:22: error: expected ')' before string constant
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:379:33: note: in definition of macro '__printk_index_emit'
379 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:883:4: note: in expansion of macro 'printk'
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
drivers/scsi/3w-sas.c:883:22: error: expected ')' before string constant
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:379:42: note: in definition of macro '__printk_index_emit'
379 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:883:4: note: in expansion of macro 'printk'
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
include/linux/printk.h:379:41: note: to match this '('
379 | .fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
| ^
include/linux/printk.h:417:3: note: in expansion of macro '__printk_index_emit'
417 | __printk_index_emit(_fmt, NULL, NULL); \
| ^~~~~~~~~~~~~~~~~~~
include/linux/printk.h:446:26: note: in expansion of macro 'printk_index_wrap'
446 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
drivers/scsi/3w-sas.c:883:4: note: in expansion of macro 'printk'
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
drivers/scsi/3w-sas.c:883:22: error: expected ')' before string constant
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/printk.h:418:11: note: in definition of macro 'printk_index_wrap'
418 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~
drivers/scsi/3w-sas.c:883:4: note: in expansion of macro 'printk'
883 | printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
| ^~~~~~
>> drivers/scsi/3w-sas.c:864:8: warning: variable 'error_str' set but not used [-Wunused-but-set-variable]
864 | char *error_str;
| ^~~~~~~~~


vim +876 drivers/scsi/3w-sas.c

857
858 /* This function passes sense data from firmware to scsi layer */
859 static int twl_fill_sense(TW_Device_Extension *tw_dev, int i, int request_id, int copy_sense, int print_host)
860 {
861 TW_Command_Apache_Header *header;
862 TW_Command_Full *full_command_packet;
863 unsigned short error;
> 864 char *error_str;
865
866 header = tw_dev->sense_buffer_virt[i];
867 full_command_packet = tw_dev->command_packet_virt[request_id];
868
869 /* Get embedded firmware error string */
870 error_str = &(header->err_specific_desc[strlen(header->err_specific_desc) + 1]);
871
872 /* Don't print error for Logical unit not supported during rollcall */
873 error = le16_to_cpu(header->status_block.error);
874 if ((error != TW_ERROR_LOGICAL_UNIT_NOT_SUPPORTED) && (error != TW_ERROR_UNIT_OFFLINE) && (error != TW_ERROR_INVALID_FIELD_IN_CDB)) {
875 if (print_host)
> 876 printk(KERN_ERROR "3w-sas: scsi%d: ERROR: (0x%02X:0x%04X): %s:%s.\n",
877 tw_dev->host->host_no,
878 TW_MESSAGE_SOURCE_CONTROLLER_ERROR,
879 header->status_block.error,
880 error_str,
881 header->err_specific_desc);
882 else
883 printk(KERN_ERROR "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
884 TW_MESSAGE_SOURCE_CONTROLLER_ERROR,
885 header->status_block.error,
886 error_str,
887 header->err_specific_desc);
888 }
889
890 if (copy_sense) {
891 memcpy(tw_dev->srb[request_id]->sense_buffer, header->sense_data, TW_SENSE_DATA_LENGTH);
892 tw_dev->srb[request_id]->result = (full_command_packet->command.newcommand.status << 1);
893 goto out;
894 }
895 out:
896 return 1;
897 } /* End twl_fill_sense() */
898

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/[email protected]