Skip to content

Commit fb5d783

Browse files
MichaelZaidmanJiri Kosina
authored andcommitted
HID: ft260: fix 'cast to restricted' kernel CI bot warnings
Fix 'cast to restricted' sparse warnings reported by kernel test robot in https://lore.kernel.org/all/[email protected]/ Reported-by: kernel test robot <[email protected]> Signed-off-by: Michael Zaidman <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 5afac72 commit fb5d783

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/hid/hid-ft260.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ static int ft260_i2c_write_read(struct ft260_device *dev, struct i2c_msg *msgs)
588588

589589
if (ft260_debug) {
590590
if (wr_len == 2)
591-
read_off = be16_to_cpu(*(u16 *)msgs[0].buf);
591+
read_off = be16_to_cpu(*(__be16 *)msgs[0].buf);
592592
else
593593
read_off = *msgs[0].buf;
594594

@@ -830,7 +830,7 @@ static int ft260_byte_show(struct hid_device *hdev, int id, u8 *cfg, int len,
830830
}
831831

832832
static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
833-
u16 *field, u8 *buf)
833+
__le16 *field, u8 *buf)
834834
{
835835
int ret;
836836

@@ -859,9 +859,9 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
859859

860860
#define FT260_I2CST_ATTR_SHOW(name) \
861861
FT260_ATTR_SHOW(name, ft260_get_i2c_status_report, \
862-
FT260_I2C_STATUS, u16, ft260_word_show)
862+
FT260_I2C_STATUS, __le16, ft260_word_show)
863863

864-
#define FT260_ATTR_STORE(name, reptype, id, req, type, func) \
864+
#define FT260_ATTR_STORE(name, reptype, id, req, type, ctype, func) \
865865
static ssize_t name##_store(struct device *kdev, \
866866
struct device_attribute *attr, \
867867
const char *buf, size_t count) \
@@ -871,7 +871,7 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
871871
type name; \
872872
int ret; \
873873
\
874-
if (!func(buf, 10, &name)) { \
874+
if (!func(buf, 10, (ctype *)&name)) { \
875875
rep.name = name; \
876876
rep.report = id; \
877877
rep.request = req; \
@@ -887,11 +887,11 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
887887

888888
#define FT260_BYTE_ATTR_STORE(name, reptype, req) \
889889
FT260_ATTR_STORE(name, reptype, FT260_SYSTEM_SETTINGS, req, \
890-
u8, kstrtou8)
890+
u8, u8, kstrtou8)
891891

892892
#define FT260_WORD_ATTR_STORE(name, reptype, req) \
893893
FT260_ATTR_STORE(name, reptype, FT260_SYSTEM_SETTINGS, req, \
894-
u16, kstrtou16)
894+
__le16, u16, kstrtou16)
895895

896896
FT260_SSTAT_ATTR_SHOW(chip_mode);
897897
static DEVICE_ATTR_RO(chip_mode);

0 commit comments

Comments
 (0)