aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-06-04 00:15:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-06 15:54:08 -0400
commitf7b41276b6b07f47c5f5212fa244385b0e3aaa30 (patch)
treea5c48de78a236e836da7d3b26e999224c975cc11
parent4cd5773a2ae6facdde3f563087a4cc50f00d9530 (diff)
misc: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because strict_strtoul() is obsolete. Thus, kstrtoul() should be used. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/ad525x_dpot.c2
-rw-r--r--drivers/misc/apds9802als.c5
-rw-r--r--drivers/misc/apds990x.c37
-rw-r--r--drivers/misc/bh1770glc.c59
-rw-r--r--drivers/misc/bh1780gli.c2
-rw-r--r--drivers/misc/carma/carma-fpga-program.c10
-rw-r--r--drivers/misc/carma/carma-fpga.c4
-rw-r--r--drivers/misc/hmc6352.c5
-rw-r--r--drivers/misc/isl29003.c24
-rw-r--r--drivers/misc/isl29020.c6
-rw-r--r--drivers/misc/lis3lv02d/lis3lv02d.c6
-rw-r--r--drivers/misc/sgi-gru/gruprocfs.c14
-rw-r--r--drivers/misc/spear13xx_pcie_gadget.c57
-rw-r--r--drivers/misc/ti_dac7512.c6
14 files changed, 154 insertions, 83 deletions
diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 8f99e8e3f0ac..0daadcf1ed7a 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -470,7 +470,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
470 !test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)) 470 !test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask))
471 return -EPERM; 471 return -EPERM;
472 472
473 err = strict_strtoul(buf, 10, &value); 473 err = kstrtoul(buf, 10, &value);
474 if (err) 474 if (err)
475 return err; 475 return err;
476 476
diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c
index 5b5fd8416b3e..0c6e037153d2 100644
--- a/drivers/misc/apds9802als.c
+++ b/drivers/misc/apds9802als.c
@@ -126,8 +126,9 @@ static ssize_t als_sensing_range_store(struct device *dev,
126 int ret_val; 126 int ret_val;
127 unsigned long val; 127 unsigned long val;
128 128
129 if (strict_strtoul(buf, 10, &val)) 129 ret_val = kstrtoul(buf, 10, &val);
130 return -EINVAL; 130 if (ret_val)
131 return ret_val;
131 132
132 if (val < 4096) 133 if (val < 4096)
133 val = 1; 134 val = 1;
diff --git a/drivers/misc/apds990x.c b/drivers/misc/apds990x.c
index 98f9bb26492a..868a30a1b417 100644
--- a/drivers/misc/apds990x.c
+++ b/drivers/misc/apds990x.c
@@ -696,9 +696,11 @@ static ssize_t apds990x_lux_calib_store(struct device *dev,
696{ 696{
697 struct apds990x_chip *chip = dev_get_drvdata(dev); 697 struct apds990x_chip *chip = dev_get_drvdata(dev);
698 unsigned long value; 698 unsigned long value;
699 int ret;
699 700
700 if (strict_strtoul(buf, 0, &value)) 701 ret = kstrtoul(buf, 0, &value);
701 return -EINVAL; 702 if (ret)
703 return ret;
702 704
703 chip->lux_calib = value; 705 chip->lux_calib = value;
704 706
@@ -759,8 +761,9 @@ static ssize_t apds990x_rate_store(struct device *dev,
759 unsigned long value; 761 unsigned long value;
760 int ret; 762 int ret;
761 763
762 if (strict_strtoul(buf, 0, &value)) 764 ret = kstrtoul(buf, 0, &value);
763 return -EINVAL; 765 if (ret)
766 return ret;
764 767
765 mutex_lock(&chip->mutex); 768 mutex_lock(&chip->mutex);
766 ret = apds990x_set_arate(chip, value); 769 ret = apds990x_set_arate(chip, value);
@@ -813,9 +816,11 @@ static ssize_t apds990x_prox_enable_store(struct device *dev,
813{ 816{
814 struct apds990x_chip *chip = dev_get_drvdata(dev); 817 struct apds990x_chip *chip = dev_get_drvdata(dev);
815 unsigned long value; 818 unsigned long value;
819 int ret;
816 820
817 if (strict_strtoul(buf, 0, &value)) 821 ret = kstrtoul(buf, 0, &value);
818 return -EINVAL; 822 if (ret)
823 return ret;
819 824
820 mutex_lock(&chip->mutex); 825 mutex_lock(&chip->mutex);
821 826
@@ -892,11 +897,12 @@ static ssize_t apds990x_lux_thresh_below_show(struct device *dev,
892static ssize_t apds990x_set_lux_thresh(struct apds990x_chip *chip, u32 *target, 897static ssize_t apds990x_set_lux_thresh(struct apds990x_chip *chip, u32 *target,
893 const char *buf) 898 const char *buf)
894{ 899{
895 int ret = 0;
896 unsigned long thresh; 900 unsigned long thresh;
901 int ret;
897 902
898 if (strict_strtoul(buf, 0, &thresh)) 903 ret = kstrtoul(buf, 0, &thresh);
899 return -EINVAL; 904 if (ret)
905 return ret;
900 906
901 if (thresh > APDS_RANGE) 907 if (thresh > APDS_RANGE)
902 return -EINVAL; 908 return -EINVAL;
@@ -957,9 +963,11 @@ static ssize_t apds990x_prox_threshold_store(struct device *dev,
957{ 963{
958 struct apds990x_chip *chip = dev_get_drvdata(dev); 964 struct apds990x_chip *chip = dev_get_drvdata(dev);
959 unsigned long value; 965 unsigned long value;
966 int ret;
960 967
961 if (strict_strtoul(buf, 0, &value)) 968 ret = kstrtoul(buf, 0, &value);
962 return -EINVAL; 969 if (ret)
970 return ret;
963 971
964 if ((value > APDS_RANGE) || (value == 0) || 972 if ((value > APDS_RANGE) || (value == 0) ||
965 (value < APDS_PROX_HYSTERESIS)) 973 (value < APDS_PROX_HYSTERESIS))
@@ -990,9 +998,12 @@ static ssize_t apds990x_power_state_store(struct device *dev,
990{ 998{
991 struct apds990x_chip *chip = dev_get_drvdata(dev); 999 struct apds990x_chip *chip = dev_get_drvdata(dev);
992 unsigned long value; 1000 unsigned long value;
1001 int ret;
1002
1003 ret = kstrtoul(buf, 0, &value);
1004 if (ret)
1005 return ret;
993 1006
994 if (strict_strtoul(buf, 0, &value))
995 return -EINVAL;
996 if (value) { 1007 if (value) {
997 pm_runtime_get_sync(dev); 1008 pm_runtime_get_sync(dev);
998 mutex_lock(&chip->mutex); 1009 mutex_lock(&chip->mutex);
diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c
index f4975f7d0d5b..99a04686e45f 100644
--- a/drivers/misc/bh1770glc.c
+++ b/drivers/misc/bh1770glc.c
@@ -651,8 +651,9 @@ static ssize_t bh1770_power_state_store(struct device *dev,
651 unsigned long value; 651 unsigned long value;
652 ssize_t ret; 652 ssize_t ret;
653 653
654 if (strict_strtoul(buf, 0, &value)) 654 ret = kstrtoul(buf, 0, &value);
655 return -EINVAL; 655 if (ret)
656 return ret;
656 657
657 mutex_lock(&chip->mutex); 658 mutex_lock(&chip->mutex);
658 if (value) { 659 if (value) {
@@ -726,9 +727,11 @@ static ssize_t bh1770_prox_enable_store(struct device *dev,
726{ 727{
727 struct bh1770_chip *chip = dev_get_drvdata(dev); 728 struct bh1770_chip *chip = dev_get_drvdata(dev);
728 unsigned long value; 729 unsigned long value;
730 int ret;
729 731
730 if (strict_strtoul(buf, 0, &value)) 732 ret = kstrtoul(buf, 0, &value);
731 return -EINVAL; 733 if (ret)
734 return ret;
732 735
733 mutex_lock(&chip->mutex); 736 mutex_lock(&chip->mutex);
734 /* Assume no proximity. Sensor will tell real state soon */ 737 /* Assume no proximity. Sensor will tell real state soon */
@@ -824,9 +827,11 @@ static ssize_t bh1770_set_prox_rate_above(struct device *dev,
824{ 827{
825 struct bh1770_chip *chip = dev_get_drvdata(dev); 828 struct bh1770_chip *chip = dev_get_drvdata(dev);
826 unsigned long value; 829 unsigned long value;
830 int ret;
827 831
828 if (strict_strtoul(buf, 0, &value)) 832 ret = kstrtoul(buf, 0, &value);
829 return -EINVAL; 833 if (ret)
834 return ret;
830 835
831 mutex_lock(&chip->mutex); 836 mutex_lock(&chip->mutex);
832 chip->prox_rate_threshold = bh1770_prox_rate_validate(value); 837 chip->prox_rate_threshold = bh1770_prox_rate_validate(value);
@@ -840,9 +845,11 @@ static ssize_t bh1770_set_prox_rate_below(struct device *dev,
840{ 845{
841 struct bh1770_chip *chip = dev_get_drvdata(dev); 846 struct bh1770_chip *chip = dev_get_drvdata(dev);
842 unsigned long value; 847 unsigned long value;
848 int ret;
843 849
844 if (strict_strtoul(buf, 0, &value)) 850 ret = kstrtoul(buf, 0, &value);
845 return -EINVAL; 851 if (ret)
852 return ret;
846 853
847 mutex_lock(&chip->mutex); 854 mutex_lock(&chip->mutex);
848 chip->prox_rate = bh1770_prox_rate_validate(value); 855 chip->prox_rate = bh1770_prox_rate_validate(value);
@@ -865,8 +872,10 @@ static ssize_t bh1770_set_prox_thres(struct device *dev,
865 unsigned long value; 872 unsigned long value;
866 int ret; 873 int ret;
867 874
868 if (strict_strtoul(buf, 0, &value)) 875 ret = kstrtoul(buf, 0, &value);
869 return -EINVAL; 876 if (ret)
877 return ret;
878
870 if (value > BH1770_PROX_RANGE) 879 if (value > BH1770_PROX_RANGE)
871 return -EINVAL; 880 return -EINVAL;
872 881
@@ -893,9 +902,11 @@ static ssize_t bh1770_prox_persistence_store(struct device *dev,
893{ 902{
894 struct bh1770_chip *chip = dev_get_drvdata(dev); 903 struct bh1770_chip *chip = dev_get_drvdata(dev);
895 unsigned long value; 904 unsigned long value;
905 int ret;
896 906
897 if (strict_strtoul(buf, 0, &value)) 907 ret = kstrtoul(buf, 0, &value);
898 return -EINVAL; 908 if (ret)
909 return ret;
899 910
900 if (value > BH1770_PROX_MAX_PERSISTENCE) 911 if (value > BH1770_PROX_MAX_PERSISTENCE)
901 return -EINVAL; 912 return -EINVAL;
@@ -918,9 +929,11 @@ static ssize_t bh1770_prox_abs_thres_store(struct device *dev,
918{ 929{
919 struct bh1770_chip *chip = dev_get_drvdata(dev); 930 struct bh1770_chip *chip = dev_get_drvdata(dev);
920 unsigned long value; 931 unsigned long value;
932 int ret;
921 933
922 if (strict_strtoul(buf, 0, &value)) 934 ret = kstrtoul(buf, 0, &value);
923 return -EINVAL; 935 if (ret)
936 return ret;
924 937
925 if (value > BH1770_PROX_RANGE) 938 if (value > BH1770_PROX_RANGE)
926 return -EINVAL; 939 return -EINVAL;
@@ -963,9 +976,11 @@ static ssize_t bh1770_lux_calib_store(struct device *dev,
963 unsigned long value; 976 unsigned long value;
964 u32 old_calib; 977 u32 old_calib;
965 u32 new_corr; 978 u32 new_corr;
979 int ret;
966 980
967 if (strict_strtoul(buf, 0, &value)) 981 ret = kstrtoul(buf, 0, &value);
968 return -EINVAL; 982 if (ret)
983 return ret;
969 984
970 mutex_lock(&chip->mutex); 985 mutex_lock(&chip->mutex);
971 old_calib = chip->lux_calib; 986 old_calib = chip->lux_calib;
@@ -1012,8 +1027,9 @@ static ssize_t bh1770_set_lux_rate(struct device *dev,
1012 unsigned long rate_hz; 1027 unsigned long rate_hz;
1013 int ret, i; 1028 int ret, i;
1014 1029
1015 if (strict_strtoul(buf, 0, &rate_hz)) 1030 ret = kstrtoul(buf, 0, &rate_hz);
1016 return -EINVAL; 1031 if (ret)
1032 return ret;
1017 1033
1018 for (i = 0; i < ARRAY_SIZE(lux_rates_hz) - 1; i++) 1034 for (i = 0; i < ARRAY_SIZE(lux_rates_hz) - 1; i++)
1019 if (rate_hz >= lux_rates_hz[i]) 1035 if (rate_hz >= lux_rates_hz[i])
@@ -1047,11 +1063,12 @@ static ssize_t bh1770_get_lux_thresh_below(struct device *dev,
1047static ssize_t bh1770_set_lux_thresh(struct bh1770_chip *chip, u16 *target, 1063static ssize_t bh1770_set_lux_thresh(struct bh1770_chip *chip, u16 *target,
1048 const char *buf) 1064 const char *buf)
1049{ 1065{
1050 int ret = 0;
1051 unsigned long thresh; 1066 unsigned long thresh;
1067 int ret;
1052 1068
1053 if (strict_strtoul(buf, 0, &thresh)) 1069 ret = kstrtoul(buf, 0, &thresh);
1054 return -EINVAL; 1070 if (ret)
1071 return ret;
1055 1072
1056 if (thresh > BH1770_LUX_RANGE) 1073 if (thresh > BH1770_LUX_RANGE)
1057 return -EINVAL; 1074 return -EINVAL;
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
index 818f3a0e62bf..057580e026c0 100644
--- a/drivers/misc/bh1780gli.c
+++ b/drivers/misc/bh1780gli.c
@@ -107,7 +107,7 @@ static ssize_t bh1780_store_power_state(struct device *dev,
107 unsigned long val; 107 unsigned long val;
108 int error; 108 int error;
109 109
110 error = strict_strtoul(buf, 0, &val); 110 error = kstrtoul(buf, 0, &val);
111 if (error) 111 if (error)
112 return error; 112 return error;
113 113
diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c
index fa017cf64bd1..c6bd7e84de24 100644
--- a/drivers/misc/carma/carma-fpga-program.c
+++ b/drivers/misc/carma/carma-fpga-program.c
@@ -830,8 +830,9 @@ static ssize_t penable_store(struct device *dev, struct device_attribute *attr,
830 unsigned long val; 830 unsigned long val;
831 int ret; 831 int ret;
832 832
833 if (strict_strtoul(buf, 0, &val)) 833 ret = kstrtoul(buf, 0, &val);
834 return -EINVAL; 834 if (ret)
835 return ret;
835 836
836 if (val) { 837 if (val) {
837 ret = fpga_enable_power_supplies(priv); 838 ret = fpga_enable_power_supplies(priv);
@@ -859,8 +860,9 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr,
859 unsigned long val; 860 unsigned long val;
860 int ret; 861 int ret;
861 862
862 if (strict_strtoul(buf, 0, &val)) 863 ret = kstrtoul(buf, 0, &val);
863 return -EINVAL; 864 if (ret)
865 return ret;
864 866
865 /* We can't have an image writer and be programming simultaneously */ 867 /* We can't have an image writer and be programming simultaneously */
866 if (mutex_lock_interruptible(&priv->lock)) 868 if (mutex_lock_interruptible(&priv->lock))
diff --git a/drivers/misc/carma/carma-fpga.c b/drivers/misc/carma/carma-fpga.c
index a2128af706b2..7b56563f8b74 100644
--- a/drivers/misc/carma/carma-fpga.c
+++ b/drivers/misc/carma/carma-fpga.c
@@ -1002,10 +1002,10 @@ static ssize_t data_en_set(struct device *dev, struct device_attribute *attr,
1002 unsigned long enable; 1002 unsigned long enable;
1003 int ret; 1003 int ret;
1004 1004
1005 ret = strict_strtoul(buf, 0, &enable); 1005 ret = kstrtoul(buf, 0, &enable);
1006 if (ret) { 1006 if (ret) {
1007 dev_err(priv->dev, "unable to parse enable input\n"); 1007 dev_err(priv->dev, "unable to parse enable input\n");
1008 return -EINVAL; 1008 return ret;
1009 } 1009 }
1010 1010
1011 /* protect against concurrent enable/disable */ 1011 /* protect against concurrent enable/disable */
diff --git a/drivers/misc/hmc6352.c b/drivers/misc/hmc6352.c
index 423cd40f1c0f..170bd3daf336 100644
--- a/drivers/misc/hmc6352.c
+++ b/drivers/misc/hmc6352.c
@@ -46,8 +46,9 @@ static int compass_store(struct device *dev, const char *buf, size_t count,
46 int ret; 46 int ret;
47 unsigned long val; 47 unsigned long val;
48 48
49 if (strict_strtoul(buf, 10, &val)) 49 ret = kstrtoul(buf, 10, &val);
50 return -EINVAL; 50 if (ret)
51 return ret;
51 if (val >= strlen(map)) 52 if (val >= strlen(map))
52 return -EINVAL; 53 return -EINVAL;
53 mutex_lock(&compass_mutex); 54 mutex_lock(&compass_mutex);
diff --git a/drivers/misc/isl29003.c b/drivers/misc/isl29003.c
index c5145b3fcce8..e3183f26216b 100644
--- a/drivers/misc/isl29003.c
+++ b/drivers/misc/isl29003.c
@@ -208,7 +208,11 @@ static ssize_t isl29003_store_range(struct device *dev,
208 unsigned long val; 208 unsigned long val;
209 int ret; 209 int ret;
210 210
211 if ((strict_strtoul(buf, 10, &val) < 0) || (val > 3)) 211 ret = kstrtoul(buf, 10, &val);
212 if (ret)
213 return ret;
214
215 if (val > 3)
212 return -EINVAL; 216 return -EINVAL;
213 217
214 ret = isl29003_set_range(client, val); 218 ret = isl29003_set_range(client, val);
@@ -239,7 +243,11 @@ static ssize_t isl29003_store_resolution(struct device *dev,
239 unsigned long val; 243 unsigned long val;
240 int ret; 244 int ret;
241 245
242 if ((strict_strtoul(buf, 10, &val) < 0) || (val > 3)) 246 ret = kstrtoul(buf, 10, &val);
247 if (ret)
248 return ret;
249
250 if (val > 3)
243 return -EINVAL; 251 return -EINVAL;
244 252
245 ret = isl29003_set_resolution(client, val); 253 ret = isl29003_set_resolution(client, val);
@@ -267,7 +275,11 @@ static ssize_t isl29003_store_mode(struct device *dev,
267 unsigned long val; 275 unsigned long val;
268 int ret; 276 int ret;
269 277
270 if ((strict_strtoul(buf, 10, &val) < 0) || (val > 2)) 278 ret = kstrtoul(buf, 10, &val);
279 if (ret)
280 return ret;
281
282 if (val > 2)
271 return -EINVAL; 283 return -EINVAL;
272 284
273 ret = isl29003_set_mode(client, val); 285 ret = isl29003_set_mode(client, val);
@@ -298,7 +310,11 @@ static ssize_t isl29003_store_power_state(struct device *dev,
298 unsigned long val; 310 unsigned long val;
299 int ret; 311 int ret;
300 312
301 if ((strict_strtoul(buf, 10, &val) < 0) || (val > 1)) 313 ret = kstrtoul(buf, 10, &val);
314 if (ret)
315 return ret;
316
317 if (val > 1)
302 return -EINVAL; 318 return -EINVAL;
303 319
304 ret = isl29003_set_power_state(client, val); 320 ret = isl29003_set_power_state(client, val);
diff --git a/drivers/misc/isl29020.c b/drivers/misc/isl29020.c
index 0aa08c746463..b7f84dacf822 100644
--- a/drivers/misc/isl29020.c
+++ b/drivers/misc/isl29020.c
@@ -90,8 +90,10 @@ static ssize_t als_sensing_range_store(struct device *dev,
90 int ret_val; 90 int ret_val;
91 unsigned long val; 91 unsigned long val;
92 92
93 if (strict_strtoul(buf, 10, &val)) 93 ret_val = kstrtoul(buf, 10, &val);
94 return -EINVAL; 94 if (ret_val)
95 return ret_val;
96
95 if (val < 1 || val > 64000) 97 if (val < 1 || val > 64000)
96 return -EINVAL; 98 return -EINVAL;
97 99
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index 4cd4a3d2a76a..036effe9a795 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -831,9 +831,11 @@ static ssize_t lis3lv02d_rate_set(struct device *dev,
831{ 831{
832 struct lis3lv02d *lis3 = dev_get_drvdata(dev); 832 struct lis3lv02d *lis3 = dev_get_drvdata(dev);
833 unsigned long rate; 833 unsigned long rate;
834 int ret;
834 835
835 if (strict_strtoul(buf, 0, &rate)) 836 ret = kstrtoul(buf, 0, &rate);
836 return -EINVAL; 837 if (ret)
838 return ret;
837 839
838 lis3lv02d_sysfs_poweron(lis3); 840 lis3lv02d_sysfs_poweron(lis3);
839 if (lis3lv02d_set_odr(lis3, rate)) 841 if (lis3lv02d_set_odr(lis3, rate))
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
index 797d7962cc88..4f7635922394 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -160,15 +160,11 @@ static int options_show(struct seq_file *s, void *p)
160static ssize_t options_write(struct file *file, const char __user *userbuf, 160static ssize_t options_write(struct file *file, const char __user *userbuf,
161 size_t count, loff_t *data) 161 size_t count, loff_t *data)
162{ 162{
163 char buf[20]; 163 int ret;
164 164
165 if (count >= sizeof(buf)) 165 ret = kstrtoul_from_user(userbuf, count, 0, &gru_options);
166 return -EINVAL; 166 if (ret)
167 if (copy_from_user(buf, userbuf, count)) 167 return ret;
168 return -EFAULT;
169 buf[count] = '\0';
170 if (strict_strtoul(buf, 0, &gru_options))
171 return -EINVAL;
172 168
173 return count; 169 return count;
174} 170}
diff --git a/drivers/misc/spear13xx_pcie_gadget.c b/drivers/misc/spear13xx_pcie_gadget.c
index 4ba0ea352968..2e13614d41e8 100644
--- a/drivers/misc/spear13xx_pcie_gadget.c
+++ b/drivers/misc/spear13xx_pcie_gadget.c
@@ -316,8 +316,12 @@ static ssize_t pcie_gadget_store_no_of_msi(
316 struct spear_pcie_gadget_config *config, 316 struct spear_pcie_gadget_config *config,
317 const char *buf, size_t count) 317 const char *buf, size_t count)
318{ 318{
319 if (strict_strtoul(buf, 0, &config->requested_msi)) 319 int ret;
320 return -EINVAL; 320
321 ret = kstrtoul(buf, 0, &config->requested_msi);
322 if (ret)
323 return ret;
324
321 if (config->requested_msi > 32) 325 if (config->requested_msi > 32)
322 config->requested_msi = 32; 326 config->requested_msi = 32;
323 327
@@ -330,9 +334,11 @@ static ssize_t pcie_gadget_store_inta(
330{ 334{
331 struct pcie_app_reg __iomem *app_reg = config->va_app_base; 335 struct pcie_app_reg __iomem *app_reg = config->va_app_base;
332 ulong en; 336 ulong en;
337 int ret;
333 338
334 if (strict_strtoul(buf, 0, &en)) 339 ret = kstrtoul(buf, 0, &en);
335 return -EINVAL; 340 if (ret)
341 return ret;
336 342
337 if (en) 343 if (en)
338 writel(readl(&app_reg->app_ctrl_0) | (1 << SYS_INT_ID), 344 writel(readl(&app_reg->app_ctrl_0) | (1 << SYS_INT_ID),
@@ -351,9 +357,11 @@ static ssize_t pcie_gadget_store_send_msi(
351 struct pcie_app_reg __iomem *app_reg = config->va_app_base; 357 struct pcie_app_reg __iomem *app_reg = config->va_app_base;
352 ulong vector; 358 ulong vector;
353 u32 ven_msi; 359 u32 ven_msi;
360 int ret;
354 361
355 if (strict_strtoul(buf, 0, &vector)) 362 ret = kstrtoul(buf, 0, &vector);
356 return -EINVAL; 363 if (ret)
364 return ret;
357 365
358 if (!config->configured_msi) 366 if (!config->configured_msi)
359 return -EINVAL; 367 return -EINVAL;
@@ -395,9 +403,11 @@ static ssize_t pcie_gadget_store_vendor_id(
395 const char *buf, size_t count) 403 const char *buf, size_t count)
396{ 404{
397 ulong id; 405 ulong id;
406 int ret;
398 407
399 if (strict_strtoul(buf, 0, &id)) 408 ret = kstrtoul(buf, 0, &id);
400 return -EINVAL; 409 if (ret)
410 return ret;
401 411
402 spear_dbi_write_reg(config, PCI_VENDOR_ID, 2, id); 412 spear_dbi_write_reg(config, PCI_VENDOR_ID, 2, id);
403 413
@@ -420,9 +430,11 @@ static ssize_t pcie_gadget_store_device_id(
420 const char *buf, size_t count) 430 const char *buf, size_t count)
421{ 431{
422 ulong id; 432 ulong id;
433 int ret;
423 434
424 if (strict_strtoul(buf, 0, &id)) 435 ret = kstrtoul(buf, 0, &id);
425 return -EINVAL; 436 if (ret)
437 return ret;
426 438
427 spear_dbi_write_reg(config, PCI_DEVICE_ID, 2, id); 439 spear_dbi_write_reg(config, PCI_DEVICE_ID, 2, id);
428 440
@@ -443,9 +455,12 @@ static ssize_t pcie_gadget_store_bar0_size(
443 ulong size; 455 ulong size;
444 u32 pos, pos1; 456 u32 pos, pos1;
445 u32 no_of_bit = 0; 457 u32 no_of_bit = 0;
458 int ret;
459
460 ret = kstrtoul(buf, 0, &size);
461 if (ret)
462 return ret;
446 463
447 if (strict_strtoul(buf, 0, &size))
448 return -EINVAL;
449 /* min bar size is 256 */ 464 /* min bar size is 256 */
450 if (size <= 0x100) 465 if (size <= 0x100)
451 size = 0x100; 466 size = 0x100;
@@ -490,9 +505,11 @@ static ssize_t pcie_gadget_store_bar0_address(
490{ 505{
491 struct pcie_app_reg __iomem *app_reg = config->va_app_base; 506 struct pcie_app_reg __iomem *app_reg = config->va_app_base;
492 ulong address; 507 ulong address;
508 int ret;
493 509
494 if (strict_strtoul(buf, 0, &address)) 510 ret = kstrtoul(buf, 0, &address);
495 return -EINVAL; 511 if (ret)
512 return ret;
496 513
497 address &= ~(config->bar0_size - 1); 514 address &= ~(config->bar0_size - 1);
498 if (config->va_bar0_address) 515 if (config->va_bar0_address)
@@ -518,9 +535,11 @@ static ssize_t pcie_gadget_store_bar0_rw_offset(
518 const char *buf, size_t count) 535 const char *buf, size_t count)
519{ 536{
520 ulong offset; 537 ulong offset;
538 int ret;
521 539
522 if (strict_strtoul(buf, 0, &offset)) 540 ret = kstrtoul(buf, 0, &offset);
523 return -EINVAL; 541 if (ret)
542 return ret;
524 543
525 if (offset % 4) 544 if (offset % 4)
526 return -EINVAL; 545 return -EINVAL;
@@ -549,9 +568,11 @@ static ssize_t pcie_gadget_store_bar0_data(
549 const char *buf, size_t count) 568 const char *buf, size_t count)
550{ 569{
551 ulong data; 570 ulong data;
571 int ret;
552 572
553 if (strict_strtoul(buf, 0, &data)) 573 ret = kstrtoul(buf, 0, &data);
554 return -EINVAL; 574 if (ret)
575 return ret;
555 576
556 if (!config->va_bar0_address) 577 if (!config->va_bar0_address)
557 return -ENOMEM; 578 return -ENOMEM;
diff --git a/drivers/misc/ti_dac7512.c b/drivers/misc/ti_dac7512.c
index 1d86407189eb..9b237221bc4e 100644
--- a/drivers/misc/ti_dac7512.c
+++ b/drivers/misc/ti_dac7512.c
@@ -33,9 +33,11 @@ static ssize_t dac7512_store_val(struct device *dev,
33 struct spi_device *spi = to_spi_device(dev); 33 struct spi_device *spi = to_spi_device(dev);
34 unsigned char tmp[2]; 34 unsigned char tmp[2];
35 unsigned long val; 35 unsigned long val;
36 int ret;
36 37
37 if (strict_strtoul(buf, 10, &val) < 0) 38 ret = kstrtoul(buf, 10, &val);
38 return -EINVAL; 39 if (ret)
40 return ret;
39 41
40 tmp[0] = val >> 8; 42 tmp[0] = val >> 8;
41 tmp[1] = val & 0xff; 43 tmp[1] = val & 0xff;