mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
usb: storage: sddr09: Use const for constant arrays
The nand_flash_ids, inquiry_response, and mode_page_01 arrays are only read, not modified. Declaring data as const makes it easier to see what's going on, and can prevent unintended writes through placement in a read-only section. Signed-off-by: Jonathan Neuschäfer <j.ne@posteo.net> Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20250228-misc-const-v3-7-09b417ded9c4@posteo.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
024ad5424c
commit
5dc02c96e4
|
|
@ -144,7 +144,7 @@ static inline char *nand_flash_manufacturer(int manuf_id) {
|
|||
* 256 MB NAND flash has a 5-byte ID with 2nd byte 0xaa, 0xba, 0xca or 0xda.
|
||||
*/
|
||||
|
||||
static struct nand_flash_dev nand_flash_ids[] = {
|
||||
static const struct nand_flash_dev nand_flash_ids[] = {
|
||||
/* NAND flash */
|
||||
{ 0x6e, 20, 8, 4, 8, 2}, /* 1 MB */
|
||||
{ 0xe8, 20, 8, 4, 8, 2}, /* 1 MB */
|
||||
|
|
@ -169,7 +169,7 @@ static struct nand_flash_dev nand_flash_ids[] = {
|
|||
{ 0,}
|
||||
};
|
||||
|
||||
static struct nand_flash_dev *
|
||||
static const struct nand_flash_dev *
|
||||
nand_find_id(unsigned char id) {
|
||||
int i;
|
||||
|
||||
|
|
@ -1133,9 +1133,9 @@ sddr09_reset(struct us_data *us) {
|
|||
}
|
||||
#endif
|
||||
|
||||
static struct nand_flash_dev *
|
||||
static const struct nand_flash_dev *
|
||||
sddr09_get_cardinfo(struct us_data *us, unsigned char flags) {
|
||||
struct nand_flash_dev *cardinfo;
|
||||
const struct nand_flash_dev *cardinfo;
|
||||
unsigned char deviceID[4];
|
||||
char blurbtxt[256];
|
||||
int result;
|
||||
|
|
@ -1545,12 +1545,12 @@ static int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
|
|||
|
||||
struct sddr09_card_info *info;
|
||||
|
||||
static unsigned char inquiry_response[8] = {
|
||||
static const unsigned char inquiry_response[8] = {
|
||||
0x00, 0x80, 0x00, 0x02, 0x1F, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/* note: no block descriptor support */
|
||||
static unsigned char mode_page_01[19] = {
|
||||
static const unsigned char mode_page_01[19] = {
|
||||
0x00, 0x0F, 0x00, 0x0, 0x0, 0x0, 0x00,
|
||||
0x01, 0x0A,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
|
|
@ -1584,7 +1584,7 @@ static int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
|
|||
}
|
||||
|
||||
if (srb->cmnd[0] == READ_CAPACITY) {
|
||||
struct nand_flash_dev *cardinfo;
|
||||
const struct nand_flash_dev *cardinfo;
|
||||
|
||||
sddr09_get_wp(us, info); /* read WP bit */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user