Skip to contentSkip to conversation

scsi: csiostor: Use str_plural() in csio_mem_intr_handler()

PATCH New Thorsten Blum 2 participants 2 messages Jul 3 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: csiostor: Use str_plural() in csio_mem_intr_handler()

Replace the manual ternary "s" pluralization with str_plural() to simplify the code. This also corrects the "0 errors" case.

---
 drivers/scsi/csiostor/csio_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/csiostor/csio_hw.c +2 -1
index df9f81f29950..44def5f92b68 100644
@@ -38,6 +38,7 @@
 #include <linux/stddef.h>
 #include <linux/delay.h>
 #include <linux/string.h>
+#include <linux/string_choices.h>
 #include <linux/compiler.h>
 #include <linux/jiffies.h>
 #include <linux/kernel.h>
@@ -3490,7 +3491,7 @@ static void csio_mem_intr_handler(struct csio_hw *hw, int idx)
 
 		csio_wr_reg32(hw, ECC_CECNT_V(ECC_CECNT_M), cnt_addr);
 		csio_warn(hw, "%u %s correctable ECC data error%s\n",
-			    cnt, name[idx], cnt > 1 ? "s" : "");
+			  cnt, name[idx], str_plural(cnt));
 	}
 	if (v & ECC_UE_INT_CAUSE_F)
 		csio_fatal(hw, "%s uncorrectable ECC data error\n", name[idx]);
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The patch introduces a build failure by including a non-existent header `<linux/string_choices.h>`…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The patch introduces a build failure by including a non-existent header <linux/string_choices.h> and calling an undefined function str_plural(). --

commit cdb7701e8f1bfc8ec07f47cf6dd02c5a65955713
Author: Thorsten Blum <[email protected]>

scsi: csiostor: Use str_plural() in csio_mem_intr_handler()

This patch simplifies the pluralization logic in csio_mem_intr_handler() by replacing a manual ternary operator with the str_plural() helper. It also adds the string_choices.h header to support this function.

drivers/scsi/csiostor/csio_hw.c line 41

Quoted 8 lines
drivers/scsi/csiostor/csio_hw.c +1 -0
@@ -38,6 +38,7 @@
 #include <linux/stddef.h>
 #include <linux/delay.h>
 #include <linux/string.h>
+#include <linux/string_choices.h>

[Severity: Low]
Does this header exist in the current tree? It appears that including linux/string_choices.h might cause a build failure if the header is not present in this kernel version.

[ ... ]

drivers/scsi/csiostor/csio_hw.c static void csio_mem_intr_handler(struct csio_hw *hw, int idx) · line 3030

Quoted 6 lines
drivers/scsi/csiostor/csio_hw.c +1 -1
@@ -3026,7 +3027,7 @@ static void csio_mem_intr_handler(struct csio_hw *hw, int idx)
 
 		csio_wr_reg32(hw, ECC_CECNT_V(ECC_CECNT_M), cnt_addr);
 		csio_warn(hw, "%u %s correctable ECC data error%s\n",
-			    cnt, name[idx], cnt > 1 ? "s" : "");
+			  cnt, name[idx], str_plural(cnt));

[Severity: Low]
Is str_plural() defined in this kernel version? If the helper function is missing, this will result in an undeclared function error during compilation.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1