summaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-07-19 17:26:13 +0200
committerJiri Kosina <jkosina@suse.cz>2009-07-20 00:03:35 +0200
commit76c317d6e5cb7f58541879006d39774596962715 (patch)
treec92ad2c0b1e4b849d99bf6c97df87b637f1fd4f6 /drivers/hid
parent4859484b0957ddc7fe3e0fa349d98b0f1c7876bd (diff)
downloadop-kernel-dev-76c317d6e5cb7f58541879006d39774596962715.zip
op-kernel-dev-76c317d6e5cb7f58541879006d39774596962715.tar.gz
HID: Move dereferences below a NULL test
If the NULL test is necessary, then the dereferences should be moved below the NULL test. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ type T; expression E,E1; identifier i,fld; statement S; @@ - T i = E->fld; + T i; ... when != E=E1 when != i if (E == NULL||...) S + i = E->fld; // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index f2c21d5..5eb10c2c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1075,14 +1075,16 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);
*/
int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt)
{
- struct hid_report_enum *report_enum = hid->report_enum + type;
- struct hid_driver *hdrv = hid->driver;
+ struct hid_report_enum *report_enum;
+ struct hid_driver *hdrv;
struct hid_report *report;
unsigned int i;
int ret;
if (!hid || !hid->driver)
return -ENODEV;
+ report_enum = hid->report_enum + type;
+ hdrv = hid->driver;
if (!size) {
dbg_hid("empty report\n");
OpenPOWER on IntegriCloud