From: Dan Carpenter <dan.carpenter@oracle.com>
To: sjackman@gmail.com
Cc: linux-input@vger.kernel.org
Subject: re: Input: elo - add support for non-pressure-sensitive touchscreens
Date: Mon, 23 May 2016 20:30:26 +0300 [thread overview]
Message-ID: <20160523173026.GA24864@mwanda> (raw)
Hello Shaun Jackman,
The patch fae3006e4b42: "Input: elo - add support for
non-pressure-sensitive touchscreens" from Aug 5, 2006, leads to the
following static checker warning:
drivers/input/touchscreen/elo.c:349 elo_connect()
warn: missing error code here? 'elo_setup_10()' failed. 'err' = '0'
drivers/input/touchscreen/elo.c
308 static int elo_connect(struct serio *serio, struct serio_driver *drv)
309 {
310 struct elo *elo;
311 struct input_dev *input_dev;
312 int err;
313
314 elo = kzalloc(sizeof(struct elo), GFP_KERNEL);
315 input_dev = input_allocate_device();
316 if (!elo || !input_dev) {
317 err = -ENOMEM;
318 goto fail1;
319 }
320
321 elo->serio = serio;
322 elo->id = serio->id.id;
323 elo->dev = input_dev;
324 elo->expected_packet = ELO10_TOUCH_PACKET;
325 mutex_init(&elo->cmd_mutex);
326 init_completion(&elo->cmd_done);
327 snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys);
328
329 input_dev->name = "Elo Serial TouchScreen";
330 input_dev->phys = elo->phys;
331 input_dev->id.bustype = BUS_RS232;
332 input_dev->id.vendor = SERIO_ELO;
333 input_dev->id.product = elo->id;
334 input_dev->id.version = 0x0100;
335 input_dev->dev.parent = &serio->dev;
336
337 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
338 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
339
340 serio_set_drvdata(serio, elo);
341 err = serio_open(serio, drv);
342 if (err)
343 goto fail2;
344
345 switch (elo->id) {
346
347 case 0: /* 10-byte protocol */
348 if (elo_setup_10(elo))
349 goto fail3;
This should return -1 (or -EPERM, I guess, if you want to avoid magic
numbers).
350
351 break;
352
353 case 1: /* 6-byte protocol */
354 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0);
355
356 case 2: /* 4-byte protocol */
357 input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
358 input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0);
359 break;
360
361 case 3: /* 3-byte protocol */
362 input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0);
363 input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0);
364 break;
365 }
366
367 err = input_register_device(elo->dev);
368 if (err)
369 goto fail3;
370
371 return 0;
372
373 fail3: serio_close(serio);
374 fail2: serio_set_drvdata(serio, NULL);
375 fail1: input_free_device(input_dev);
376 kfree(elo);
377 return err;
378 }
regards,
dan carpenter
next reply other threads:[~2016-05-23 17:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 17:30 Dan Carpenter [this message]
2016-05-23 21:02 ` Input: elo - add support for non-pressure-sensitive touchscreens Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160523173026.GA24864@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-input@vger.kernel.org \
--cc=sjackman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.