Skip to contentSkip to conversation

DS1374: check for workqueue creation

PATCH New Cyrill V. Gorcunov 1 participant 1 message Feb 16, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DS1374: check for workqueue creation

This patch checks if workqueue creation failed.
Further usage of NULL pointed workqueue is not
good I guess ;)

---

 drivers/i2c/chips/ds1374.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/i2c/chips/ds1374.c +4 -0
index 15edf40..8a2ff0c 100644
@@ -207,6 +207,10 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind)
 	client->driver = &ds1374_driver;
 
 	ds1374_workqueue = create_singlethread_workqueue("ds1374");
+	if (!ds1374_workqueue) {
+		kfree(client);
+		return -ENOMEM;	/* most expected reason */
+	}
 
 	if ((rc = i2c_attach_client(client)) != 0) {
 		kfree(client);