diff mbox

touchscreen/bu21013_ts: null dereference in error handling

Message ID 20101027100822.GF6062@bicker (mailing list archive)
State Superseded
Headers show

Commit Message

Dan Carpenter Oct. 27, 2010, 10:08 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c
index ccde586..8f120b1 100644
--- a/drivers/input/touchscreen/bu21013_ts.c
+++ b/drivers/input/touchscreen/bu21013_ts.c
@@ -446,11 +446,14 @@  static int __devinit bu21013_probe(struct i2c_client *client,
 	}
 
 	bu21013_data = kzalloc(sizeof(struct bu21013_ts_data), GFP_KERNEL);
+	if (!bu21013_data)
+		return -ENOMEM;
+
 	in_dev = input_allocate_device();
-	if (!bu21013_data || !in_dev) {
+	if (!in_dev) {
 		dev_err(&client->dev, "device memory alloc failed\n");
 		error = -ENOMEM;
-		goto err_free_mem;
+		goto err_free;
 	}
 
 	bu21013_data->in_dev = in_dev;
@@ -515,6 +518,7 @@  err_cs_disable:
 	pdata->cs_dis(pdata->cs_pin);
 err_free_mem:
 	input_free_device(bu21013_data->in_dev);
+err_free:
 	kfree(bu21013_data);
 
 	return error;