drivers/fsi: Don't scan after fsi-gpio-master unbound
PATCH 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.
Signed-off-by Christopher Bostic <[email protected]>
--- drivers/fsi/fsi-master-gpio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/fsi/fsi-master-gpio.c +8 -1
@@ -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 count; + + master =dev_get_drvdata (dev); +if (!master) +return count;fsi_master_gpio_init (master);
Signature · 1 line
1.8.2.2
Quoted 15 lines · Christopher Bostic
Check pointers prior to scanning master in the sysfs scan file. These get invalidated after an unbind operation.
Signed-off-by Christopher Bostic <[email protected]>--- drivers/fsi/fsi-master-gpio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/fsi/fsi-master-gpio.c +0
-0@@ -476,7 +476,14 @@ static ssize_t store_scan(struct device *dev,const char *buf, size_t count)
drivers/fsi/fsi-master-gpio.c static ssize_t store_scan(struct device *dev, · line 486
Quoted 10 lines
drivers/fsi/fsi-master-gpio.c +8
-1{ -struct fsi_master_gpio *master =dev_get_drvdata (dev); +struct fsi_master_gpio *master; + +if (!dev) +return count; + + master =dev_get_drvdata (dev); +if (!master) +return count;
Returning count implies that you've stored the data the user has written. You should return an error in the case where there is an error.
Cheers,
Joel
Quoted 6 lines
drivers/fsi/fsi-master-gpio.c +0
-1fsi_master_gpio_init (master); --1.8.2.2