Skip to contentSkip to conversation

ata/pata_it821x: set array of const as const

PATCH New LABBE Corentin 2 participants 2 messages Oct 14, 2015 – Oct 15, 2015 libata

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ata/pata_it821x: set array of const as const

Some array of const char are not set as const.
This patch fix that.

---
 drivers/ata/pata_it821x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ata/pata_it821x.c +3 -3
index a5088ec..7a21edf 100644
@@ -604,9 +604,9 @@ static void it821x_display_disk(int n, u8 *buf)
 {
 	unsigned char id[41];
 	int mode = 0;
-	char *mtype = "";
+	const char *mtype = "";
 	char mbuf[8];
-	char *cbl = "(40 wire cable)";
+	const char *cbl = "(40 wire cable)";
 
 	static const char *types[5] = {
 		"RAID0", "RAID1", "RAID 0+1", "JBOD", "DISK"
@@ -903,7 +903,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	};
 
 	const struct ata_port_info *ppi[] = { NULL, NULL };
-	static char *mode[2] = { "pass through", "smart" };
+	static const char *mode[2] = { "pass through", "smart" };
 	int rc;
 
 	rc = pcim_enable_device(pdev);
Signature · 1 line
2.4.9
#1 lore raw

PATCH 1/1 pata_it821x: use "const char *" for string literals

Hello,

Applied with updates to title and description.

Thanks.
----- 8< -----

Quoted 1 line

From 3a53b3bcc7af2f7ddfb682cb8efb26e40fe50fb1 Mon Sep 17 00:00:00 2001

From: LABBE Corentin <[email protected]>
Date: Wed, 14 Oct 2015 21:18:31 +0200

Some string literals are pointed to by "char *". This patch fixes that.

tj: Updated patch title and description.

---
 drivers/ata/pata_it821x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ata/pata_it821x.c +3 -3
index a5088ec..7a21edf 100644
@@ -604,9 +604,9 @@ static void it821x_display_disk(int n, u8 *buf)
 {
 	unsigned char id[41];
 	int mode = 0;
-	char *mtype = "";
+	const char *mtype = "";
 	char mbuf[8];
-	char *cbl = "(40 wire cable)";
+	const char *cbl = "(40 wire cable)";
 
 	static const char *types[5] = {
 		"RAID0", "RAID1", "RAID 0+1", "JBOD", "DISK"
@@ -903,7 +903,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	};
 
 	const struct ata_port_info *ppi[] = { NULL, NULL };
-	static char *mode[2] = { "pass through", "smart" };
+	static const char *mode[2] = { "pass through", "smart" };
 	int rc;
 
 	rc = pcim_enable_device(pdev);
Signature · 1 line
2.4.3