Skip to contentSkip to conversation

drivers/fsi: Don't scan after fsi-gpio_master unbound

PATCH Applied Christopher Bostic 2 participants 2 messages Mar 2, 2017 – Mar 3, 2017 FSI

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drivers/fsi: Don't scan after fsi-gpio_master unbound

Check pointers prior to scanning master in the sysfs scan file. These get invalidated after an unbind operation.

---
v2:
Return error if invalid pointers passed in.

---
 drivers/fsi/fsi-master-gpio.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/fsi/fsi-master-gpio.c +8 -1
index c5f4f9c..49f3399 100644
@@ -476,7 +476,14 @@ static ssize_t store_scan(struct device *dev,
 				const char *buf,
 				size_t count)
 {
-	struct fsi_master_gpio *master = dev_get_drvdata(dev);
+	struct fsi_master_gpio *master;
+
+	if (!dev)
+		return -EINVAL;
+
+	master = dev_get_drvdata(dev);
+	if (!master)
+		return -EINVAL;
 
 	fsi_master_gpio_init(master);
 
Signature · 1 line
1.8.2.2
Applied
#1 lore raw
Quoted 7 lines · Christopher Bostic

Check pointers prior to scanning master in the sysfs scan file. These get invalidated after an unbind operation.

---
v2:
Return error if invalid pointers passed in.

Thanks, I think this is better.

Applied to dev-4.7.

Cheers,

Joel

Quoted 27 lines
---
 drivers/fsi/fsi-master-gpio.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/fsi/fsi-master-gpio.c +8 -2
index c5f4f9c..49f3399 100644
@@ -476,7 +476,14 @@ static ssize_t store_scan(struct device *dev,
                                const char *buf,
                                size_t count)
 {
-       struct fsi_master_gpio *master = dev_get_drvdata(dev);
+       struct fsi_master_gpio *master;
+
+       if (!dev)
+               return -EINVAL;
+
+       master = dev_get_drvdata(dev);
+       if (!master)
+               return -EINVAL;
 
        fsi_master_gpio_init(master);
 
--

1.8.2.2