diff mbox series

scsi: megaraid_sas: Fix inconsistent of format with argument type in megaraid_sas_base.c

Message ID 20200930022124.2840018-1-yebin10@huawei.com (mailing list archive)
State Changes Requested
Headers show
Series scsi: megaraid_sas: Fix inconsistent of format with argument type in megaraid_sas_base.c | expand

Commit Message

yebin (H) Sept. 30, 2020, 2:21 a.m. UTC
Fix follow warnings:
[drivers/scsi/megaraid/megaraid_sas_base.c:3294]: (warning) %d in format string (no. 1)
	requires 'int' but the argument type is 'unsigned int'.
[drivers/scsi/megaraid/megaraid_sas_base.c:3301]: (warning) %ld in format string (no. 1)
	requires 'long' but the argument type is 'unsigned long'.
[drivers/scsi/megaraid/megaraid_sas_base.c:3385]: (warning) %ld in format string (no. 1)
	requires 'long' but the argument type is 'unsigned long'.
[drivers/scsi/megaraid/megaraid_sas_base.c:5606]: (warning) %u in format string (no. 3)
	requires 'unsigned int' but the argument type is 'int'.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Martin K. Petersen Oct. 8, 2020, 3:05 a.m. UTC | #1
Ye,

> @@ -5603,7 +5603,7 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe)
>  	for (i = 0; i < instance->msix_vectors; i++) {
>  		instance->irq_context[i].instance = instance;
>  		instance->irq_context[i].MSIxIndex = i;
> -		snprintf(instance->irq_context[i].name, MEGASAS_MSIX_NAME_LEN, "%s%u-msix%u",
> +		snprintf(instance->irq_context[i].name, MEGASAS_MSIX_NAME_LEN, "%s%u-msix%d",

It's probably better to make the index unsigned.
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index e158d3d62056..3dfc3057fb3f 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3291,14 +3291,14 @@  fw_crash_state_show(struct device *cdev,
 	struct megasas_instance *instance =
 		(struct megasas_instance *) shost->hostdata;
 
-	return snprintf(buf, PAGE_SIZE, "%d\n", instance->fw_crash_state);
+	return snprintf(buf, PAGE_SIZE, "%u\n", instance->fw_crash_state);
 }
 
 static ssize_t
 page_size_show(struct device *cdev,
 	struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%ld\n", (unsigned long)PAGE_SIZE - 1);
+	return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)PAGE_SIZE - 1);
 }
 
 static ssize_t
@@ -3382,7 +3382,7 @@  raid_map_id_show(struct device *cdev, struct device_attribute *attr,
 	struct megasas_instance *instance =
 			(struct megasas_instance *)shost->hostdata;
 
-	return snprintf(buf, PAGE_SIZE, "%ld\n",
+	return snprintf(buf, PAGE_SIZE, "%lu\n",
 			(unsigned long)instance->map_id);
 }
 
@@ -5603,7 +5603,7 @@  megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe)
 	for (i = 0; i < instance->msix_vectors; i++) {
 		instance->irq_context[i].instance = instance;
 		instance->irq_context[i].MSIxIndex = i;
-		snprintf(instance->irq_context[i].name, MEGASAS_MSIX_NAME_LEN, "%s%u-msix%u",
+		snprintf(instance->irq_context[i].name, MEGASAS_MSIX_NAME_LEN, "%s%u-msix%d",
 			"megasas", instance->host->host_no, i);
 		if (request_irq(pci_irq_vector(pdev, i),
 			instance->instancet->service_isr, 0, instance->irq_context[i].name,