Skip to contentSkip to conversation

scsi: check the return value of device_create_file() in powertec.c

PATCH In review Qinghuang Feng 2 participants 2 messages May 25, 2008 – May 28, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: check the return value of device_create_file() in powertec.c

This patch adds code to check the return value of device_create_file() called from powertecscsi_probe() in powertec.c

---

drivers/scsi/arm/powertec.c +5 -1
index d9a546d..d695a6d 100644
@@ -361,7 +361,9 @@ powertecscsi_probe(struct expansion_card
 
 	ecard_setirq(ec, &powertecscsi_ops, info);
 
-	device_create_file(&ec->dev, &dev_attr_bus_term);
+	ret = device_create_file(&ec->dev, &dev_attr_bus_term);
+	if (ret)
+		goto out_put;
 
 	ret = fas216_init(host);
 	if (ret)
@@ -399,6 +401,8 @@ powertecscsi_probe(struct expansion_card
 
  out_free:
 	device_remove_file(&ec->dev, &dev_attr_bus_term);
+
+ out_put:
 	scsi_host_put(host);
 
  out_region:
#1 lore raw
Quoted 1 line · Qinghuang Feng

This patch adds code to check the return value of device_create_file() called from powertecscsi_probe() in powertec.c

I'd prefer not to kill the driver if device_create_file fails. Just arrange to print a warning instead (and remember not to unregister the file if it wasn't created.)