Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: ahci_ceva: Fix id array access in ceva_ahci_read_id()

ATA IDENTIFY command returns an array of le16 words. Accessing it as a
u16 array triggers the following sparse warning:

drivers/ata/ahci_ceva.c:107:33: warning: invalid assignment: &=
drivers/ata/ahci_ceva.c:107:33: left side has type unsigned short
drivers/ata/ahci_ceva.c:107:33: right side has type restricted __le16

Use a local variable to explicitly cast the id array to __le16 to avoid
this warning.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

+2 -1
+2 -1
drivers/ata/ahci_ceva.c
··· 94 94 static unsigned int ceva_ahci_read_id(struct ata_device *dev, 95 95 struct ata_taskfile *tf, u16 *id) 96 96 { 97 + __le16 *__id = (__le16 *)id; 97 98 u32 err_mask; 98 99 99 100 err_mask = ata_do_dev_read_id(dev, tf, id); ··· 104 103 * Since CEVA controller does not support device sleep feature, we 105 104 * need to clear DEVSLP (bit 8) in word78 of the IDENTIFY DEVICE data. 106 105 */ 107 - id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8)); 106 + __id[ATA_ID_FEATURE_SUPP] &= cpu_to_le16(~(1 << 8)); 108 107 109 108 return 0; 110 109 }