All of lore.kernel.org
 help / color / mirror / Atom feed
* re: HID: hid-multitouch: Switch to device groups
@ 2012-08-08 13:44 Dan Carpenter
  2012-08-08 17:28 ` Henrik Rydberg
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2012-08-08 13:44 UTC (permalink / raw)
  To: rydberg; +Cc: linux-input

Hello Henrik Rydberg,

This is a semi-automatic email about new static checker warnings.

The patch 4fa3a5837b84: "HID: hid-multitouch: Switch to device 
groups" from May 1, 2012, leads to the following Smatch complaint:

drivers/hid/hid-multitouch.c:735 mt_probe()
	 error: we previously assumed 'id' could be null (see line 694)

drivers/hid/hid-multitouch.c
   693	
   694		if (id) {
                   ^^^^
Old check.

   695			for (i = 0; mt_classes[i].name ; i++) {
   696				if (id->driver_data == mt_classes[i].name) {
   697					mtclass = &(mt_classes[i]);
   698					break;
   699				}
   700			}
   701		}
   702	

[snip]

   733		mt_post_parse(td);
   734	
   735		if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
                    ^^^^^^^^^^
New dereference removed a check.

   736			mt_post_parse_default_settings(td);
   737	

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HID: hid-multitouch: Switch to device groups
  2012-08-08 13:44 HID: hid-multitouch: Switch to device groups Dan Carpenter
@ 2012-08-08 17:28 ` Henrik Rydberg
  2012-08-08 18:07   ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Henrik Rydberg @ 2012-08-08 17:28 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-input

Hi Dan,

> This is a semi-automatic email about new static checker warnings.
> 
> The patch 4fa3a5837b84: "HID: hid-multitouch: Switch to device 
> groups" from May 1, 2012, leads to the following Smatch complaint:
> 
> drivers/hid/hid-multitouch.c:735 mt_probe()
> 	 error: we previously assumed 'id' could be null (see line 694)

Yes, and the same patch also removes the reason 'id' could be null.

Thanks,
Henrik

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HID: hid-multitouch: Switch to device groups
  2012-08-08 17:28 ` Henrik Rydberg
@ 2012-08-08 18:07   ` Dan Carpenter
  2012-08-08 19:54     ` Henrik Rydberg
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2012-08-08 18:07 UTC (permalink / raw)
  To: Henrik Rydberg; +Cc: linux-input

On Wed, Aug 08, 2012 at 07:28:29PM +0200, Henrik Rydberg wrote:
> Hi Dan,
> 
> > This is a semi-automatic email about new static checker warnings.
> > 
> > The patch 4fa3a5837b84: "HID: hid-multitouch: Switch to device 
> > groups" from May 1, 2012, leads to the following Smatch complaint:
> > 
> > drivers/hid/hid-multitouch.c:735 mt_probe()
> > 	 error: we previously assumed 'id' could be null (see line 694)
> 
> Yes, and the same patch also removes the reason 'id' could be null.

Great.  Could you remove the unneeded check in mt_probe() and give
me a Reported-by: tag?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HID: hid-multitouch: Switch to device groups
  2012-08-08 18:07   ` Dan Carpenter
@ 2012-08-08 19:54     ` Henrik Rydberg
  2012-08-15  8:38       ` Jiri Kosina
  0 siblings, 1 reply; 5+ messages in thread
From: Henrik Rydberg @ 2012-08-08 19:54 UTC (permalink / raw)
  To: Jiri Kosina, Dan Carpenter; +Cc: linux-input

On Wed, Aug 08, 2012 at 09:07:58PM +0300, Dan Carpenter wrote:
> On Wed, Aug 08, 2012 at 07:28:29PM +0200, Henrik Rydberg wrote:
> > Hi Dan,
> > 
> > > This is a semi-automatic email about new static checker warnings.
> > > 
> > > The patch 4fa3a5837b84: "HID: hid-multitouch: Switch to device 
> > > groups" from May 1, 2012, leads to the following Smatch complaint:
> > > 
> > > drivers/hid/hid-multitouch.c:735 mt_probe()
> > > 	 error: we previously assumed 'id' could be null (see line 694)
> > 
> > Yes, and the same patch also removes the reason 'id' could be null.
> 
> Great.  Could you remove the unneeded check in mt_probe() and give
> me a Reported-by: tag?

Ok, now I get it - I was pretty sure that test was not in mainline
anymore, but obviously I was wrong. Jiri, here is a patch for it, at
your convenience.

Thanks,
Henrik

---

>From 9e763540dd474648544da165955e44549a3990a0 Mon Sep 17 00:00:00 2001
From: Henrik Rydberg <rydberg@euromail.se>
Date: Wed, 8 Aug 2012 21:45:50 +0200
Subject: [PATCH] HID: hid-multitouch: Remove misleading null test

A null test was left behind during the autoloading work;
the test was introduced by 8d179a9e, but was never completely
reverted.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
 drivers/hid/hid-multitouch.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 59c8b5c..f027cc9 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -691,12 +691,10 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	struct mt_device *td;
 	struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
 
-	if (id) {
-		for (i = 0; mt_classes[i].name ; i++) {
-			if (id->driver_data == mt_classes[i].name) {
-				mtclass = &(mt_classes[i]);
-				break;
-			}
+	for (i = 0; mt_classes[i].name ; i++) {
+		if (id->driver_data == mt_classes[i].name) {
+			mtclass = &(mt_classes[i]);
+			break;
 		}
 	}
 
-- 
1.7.11.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: HID: hid-multitouch: Switch to device groups
  2012-08-08 19:54     ` Henrik Rydberg
@ 2012-08-15  8:38       ` Jiri Kosina
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2012-08-15  8:38 UTC (permalink / raw)
  To: Henrik Rydberg; +Cc: Dan Carpenter, linux-input

On Wed, 8 Aug 2012, Henrik Rydberg wrote:

> > > > This is a semi-automatic email about new static checker warnings.
> > > > 
> > > > The patch 4fa3a5837b84: "HID: hid-multitouch: Switch to device 
> > > > groups" from May 1, 2012, leads to the following Smatch complaint:
> > > > 
> > > > drivers/hid/hid-multitouch.c:735 mt_probe()
> > > > 	 error: we previously assumed 'id' could be null (see line 694)
> > > 
> > > Yes, and the same patch also removes the reason 'id' could be null.
> > 
> > Great.  Could you remove the unneeded check in mt_probe() and give
> > me a Reported-by: tag?
> 
> Ok, now I get it - I was pretty sure that test was not in mainline
> anymore, but obviously I was wrong. Jiri, here is a patch for it, at
> your convenience.

Applied, thanks Dan, thanks Henrik.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-15  8:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-08 13:44 HID: hid-multitouch: Switch to device groups Dan Carpenter
2012-08-08 17:28 ` Henrik Rydberg
2012-08-08 18:07   ` Dan Carpenter
2012-08-08 19:54     ` Henrik Rydberg
2012-08-15  8:38       ` Jiri Kosina

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.