Skip to content

Commit 073b50b

Browse files
jigpuJiri Kosina
authored andcommitted
HID: wacom: Fix several minor compiler warnings
Addresses a few issues that were noticed when compiling with non-default warnings enabled. The trimmed-down warnings in the order they are fixed below are: * declaration of 'size' shadows a parameter * '%s' directive output may be truncated writing up to 5 bytes into a region of size between 1 and 64 * pointer targets in initialization of 'char *' from 'unsigned char *' differ in signedness * left shift of negative value Signed-off-by: Jason Gerecke <[email protected]> Reviewed-by: Aaron Armstrong Skomra <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent f4eb142 commit 073b50b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

drivers/hid/wacom_sys.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static void wacom_wac_queue_flush(struct hid_device *hdev,
8888
}
8989

9090
static int wacom_wac_pen_serial_enforce(struct hid_device *hdev,
91-
struct hid_report *report, u8 *raw_data, int size)
91+
struct hid_report *report, u8 *raw_data, int report_size)
9292
{
9393
struct wacom *wacom = hid_get_drvdata(hdev);
9494
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
@@ -149,7 +149,8 @@ static int wacom_wac_pen_serial_enforce(struct hid_device *hdev,
149149
if (flush)
150150
wacom_wac_queue_flush(hdev, &wacom_wac->pen_fifo);
151151
else if (insert)
152-
wacom_wac_queue_insert(hdev, &wacom_wac->pen_fifo, raw_data, size);
152+
wacom_wac_queue_insert(hdev, &wacom_wac->pen_fifo,
153+
raw_data, report_size);
153154

154155
return insert && !flush;
155156
}
@@ -2176,7 +2177,7 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
21762177
{
21772178
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
21782179
struct wacom_features *features = &wacom_wac->features;
2179-
char name[WACOM_NAME_MAX];
2180+
char name[WACOM_NAME_MAX - 20]; /* Leave some room for suffixes */
21802181

21812182
/* Generic devices name unspecified */
21822183
if ((features->type == HID_GENERIC) && !strcmp("Wacom HID", features->name)) {

drivers/hid/wacom_wac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ static int wacom_dtu_irq(struct wacom_wac *wacom)
251251

252252
static int wacom_dtus_irq(struct wacom_wac *wacom)
253253
{
254-
char *data = wacom->data;
254+
unsigned char *data = wacom->data;
255255
struct input_dev *input = wacom->pen_input;
256256
unsigned short prox, pressure = 0;
257257

@@ -572,7 +572,7 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)
572572
strip2 = ((data[3] & 0x1f) << 8) | data[4];
573573
}
574574

575-
prox = (buttons & ~(~0 << nbuttons)) | (keys & ~(~0 << nkeys)) |
575+
prox = (buttons & ~(~0U << nbuttons)) | (keys & ~(~0U << nkeys)) |
576576
(ring1 & 0x80) | (ring2 & 0x80) | strip1 | strip2;
577577

578578
wacom_report_numbered_buttons(input, nbuttons, buttons);

0 commit comments

Comments
 (0)