From 2154e0a4f43e0c811737e391e7981d331e450d42 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 1 Mar 2013 23:31:46 +0300 Subject: applicom: use correct array offset We're iterating through abps[] printing information, but here we use the wrong array index. IndexCard comes from the user and in this case it was specifically not range checked because we didn't expect to use it. Signed-off-by: Dan Carpenter Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/char/applicom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index 25373df1dcf8..974321a2508d 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c @@ -804,8 +804,8 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg) printk(KERN_INFO "Prom version board %d ....... V%d.%d %s", i+1, - (int)(readb(apbs[IndexCard].RamIO + VERS) >> 4), - (int)(readb(apbs[IndexCard].RamIO + VERS) & 0xF), + (int)(readb(apbs[i].RamIO + VERS) >> 4), + (int)(readb(apbs[i].RamIO + VERS) & 0xF), boardname); -- cgit v1.2.3-59-g8ed1b From e7c2199ff300fcf88673a1cf6d7229e6c3da09de Mon Sep 17 00:00:00 2001 From: Fabio Porcedda Date: Thu, 14 Mar 2013 18:09:33 +0100 Subject: drivers: char: use module_platform_driver_probe() This patch converts the drivers to use the module_platform_driver_probe() macro which makes the code smaller and a bit simpler. Signed-off-by: Fabio Porcedda Cc: Matt Mackall Cc: Herbert Xu Cc: Fabio Estevam Cc: Sascha Hauer Signed-off-by: Greg Kroah-Hartman --- drivers/char/hw_random/mxc-rnga.c | 13 +------------ drivers/char/hw_random/tx4939-rng.c | 13 +------------ 2 files changed, 2 insertions(+), 24 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c index f05d85713fd3..895d0b8fb9ab 100644 --- a/drivers/char/hw_random/mxc-rnga.c +++ b/drivers/char/hw_random/mxc-rnga.c @@ -228,18 +228,7 @@ static struct platform_driver mxc_rnga_driver = { .remove = __exit_p(mxc_rnga_remove), }; -static int __init mod_init(void) -{ - return platform_driver_probe(&mxc_rnga_driver, mxc_rnga_probe); -} - -static void __exit mod_exit(void) -{ - platform_driver_unregister(&mxc_rnga_driver); -} - -module_init(mod_init); -module_exit(mod_exit); +module_platform_driver_probe(mxc_rnga_driver, mxc_rnga_probe); MODULE_AUTHOR("Freescale Semiconductor, Inc."); MODULE_DESCRIPTION("H/W RNGA driver for i.MX"); diff --git a/drivers/char/hw_random/tx4939-rng.c b/drivers/char/hw_random/tx4939-rng.c index 30991989d65b..d34a24a0d484 100644 --- a/drivers/char/hw_random/tx4939-rng.c +++ b/drivers/char/hw_random/tx4939-rng.c @@ -166,18 +166,7 @@ static struct platform_driver tx4939_rng_driver = { .remove = tx4939_rng_remove, }; -static int __init tx4939rng_init(void) -{ - return platform_driver_probe(&tx4939_rng_driver, tx4939_rng_probe); -} - -static void __exit tx4939rng_exit(void) -{ - platform_driver_unregister(&tx4939_rng_driver); -} - -module_init(tx4939rng_init); -module_exit(tx4939rng_exit); +module_platform_driver_probe(tx4939_rng_driver, tx4939_rng_probe); MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver for TX4939"); MODULE_LICENSE("GPL"); -- cgit v1.2.3-59-g8ed1b From 275b5d2061c20749582060be68b6ec4692736d28 Mon Sep 17 00:00:00 2001 From: Alexandru Gheorghiu Date: Sat, 16 Mar 2013 16:19:51 +0200 Subject: drivers: char: Use PTR_RET function Used PTR_RET function instead of IS_ERR and PTR_ERR. Patch found using coccinelle. Signed-off-by: Alexandru Gheorghiu Signed-off-by: Greg Kroah-Hartman --- drivers/char/tile-srom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c index 3b22a606f79d..2e2036e940fc 100644 --- a/drivers/char/tile-srom.c +++ b/drivers/char/tile-srom.c @@ -371,7 +371,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index) dev = device_create(srom_class, &platform_bus, MKDEV(srom_major, index), srom, "%d", index); - return IS_ERR(dev) ? PTR_ERR(dev) : 0; + return PTR_RET(dev); } /** srom_init() - Initialize the driver's module. */ -- cgit v1.2.3-59-g8ed1b