Commit f7b41276 authored by Jingoo Han's avatar Jingoo Han Committed by Greg Kroah-Hartman

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: default avatarJingoo Han <jg1.han@samsung.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4cd5773a
...@@ -470,7 +470,7 @@ static ssize_t sysfs_set_reg(struct device *dev, ...@@ -470,7 +470,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
!test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)) !test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask))
return -EPERM; return -EPERM;
err = strict_strtoul(buf, 10, &value); err = kstrtoul(buf, 10, &value);
if (err) if (err)
return err; return err;
......
...@@ -126,8 +126,9 @@ static ssize_t als_sensing_range_store(struct device *dev, ...@@ -126,8 +126,9 @@ static ssize_t als_sensing_range_store(struct device *dev,
int ret_val; int ret_val;
unsigned long val; unsigned long val;
if (strict_strtoul(buf, 10, &val)) ret_val = kstrtoul(buf, 10, &val);
return -EINVAL; if (ret_val)
return ret_val;
if (val < 4096) if (val < 4096)
val = 1; val = 1;
......
...@@ -696,9 +696,11 @@ static ssize_t apds990x_lux_calib_store(struct device *dev, ...@@ -696,9 +696,11 @@ static ssize_t apds990x_lux_calib_store(struct device *dev,
{ {
struct apds990x_chip *chip = dev_get_drvdata(dev); struct apds990x_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
chip->lux_calib = value; chip->lux_calib = value;
...@@ -759,8 +761,9 @@ static ssize_t apds990x_rate_store(struct device *dev, ...@@ -759,8 +761,9 @@ static ssize_t apds990x_rate_store(struct device *dev,
unsigned long value; unsigned long value;
int ret; int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
ret = apds990x_set_arate(chip, value); ret = apds990x_set_arate(chip, value);
...@@ -813,9 +816,11 @@ static ssize_t apds990x_prox_enable_store(struct device *dev, ...@@ -813,9 +816,11 @@ static ssize_t apds990x_prox_enable_store(struct device *dev,
{ {
struct apds990x_chip *chip = dev_get_drvdata(dev); struct apds990x_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
...@@ -892,11 +897,12 @@ static ssize_t apds990x_lux_thresh_below_show(struct device *dev, ...@@ -892,11 +897,12 @@ static ssize_t apds990x_lux_thresh_below_show(struct device *dev,
static ssize_t apds990x_set_lux_thresh(struct apds990x_chip *chip, u32 *target, static ssize_t apds990x_set_lux_thresh(struct apds990x_chip *chip, u32 *target,
const char *buf) const char *buf)
{ {
int ret = 0;
unsigned long thresh; unsigned long thresh;
int ret;
if (strict_strtoul(buf, 0, &thresh)) ret = kstrtoul(buf, 0, &thresh);
return -EINVAL; if (ret)
return ret;
if (thresh > APDS_RANGE) if (thresh > APDS_RANGE)
return -EINVAL; return -EINVAL;
...@@ -957,9 +963,11 @@ static ssize_t apds990x_prox_threshold_store(struct device *dev, ...@@ -957,9 +963,11 @@ static ssize_t apds990x_prox_threshold_store(struct device *dev,
{ {
struct apds990x_chip *chip = dev_get_drvdata(dev); struct apds990x_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
if ((value > APDS_RANGE) || (value == 0) || if ((value > APDS_RANGE) || (value == 0) ||
(value < APDS_PROX_HYSTERESIS)) (value < APDS_PROX_HYSTERESIS))
...@@ -990,9 +998,12 @@ static ssize_t apds990x_power_state_store(struct device *dev, ...@@ -990,9 +998,12 @@ static ssize_t apds990x_power_state_store(struct device *dev,
{ {
struct apds990x_chip *chip = dev_get_drvdata(dev); struct apds990x_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
ret = kstrtoul(buf, 0, &value);
if (ret)
return ret;
if (strict_strtoul(buf, 0, &value))
return -EINVAL;
if (value) { if (value) {
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
......
...@@ -651,8 +651,9 @@ static ssize_t bh1770_power_state_store(struct device *dev, ...@@ -651,8 +651,9 @@ static ssize_t bh1770_power_state_store(struct device *dev,
unsigned long value; unsigned long value;
ssize_t ret; ssize_t ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
if (value) { if (value) {
...@@ -726,9 +727,11 @@ static ssize_t bh1770_prox_enable_store(struct device *dev, ...@@ -726,9 +727,11 @@ static ssize_t bh1770_prox_enable_store(struct device *dev,
{ {
struct bh1770_chip *chip = dev_get_drvdata(dev); struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
/* Assume no proximity. Sensor will tell real state soon */ /* 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,9 +827,11 @@ static ssize_t bh1770_set_prox_rate_above(struct device *dev,
{ {
struct bh1770_chip *chip = dev_get_drvdata(dev); struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
chip->prox_rate_threshold = bh1770_prox_rate_validate(value); 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,9 +845,11 @@ static ssize_t bh1770_set_prox_rate_below(struct device *dev,
{ {
struct bh1770_chip *chip = dev_get_drvdata(dev); struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
chip->prox_rate = bh1770_prox_rate_validate(value); chip->prox_rate = bh1770_prox_rate_validate(value);
...@@ -865,8 +872,10 @@ static ssize_t bh1770_set_prox_thres(struct device *dev, ...@@ -865,8 +872,10 @@ static ssize_t bh1770_set_prox_thres(struct device *dev,
unsigned long value; unsigned long value;
int ret; int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
if (value > BH1770_PROX_RANGE) if (value > BH1770_PROX_RANGE)
return -EINVAL; return -EINVAL;
...@@ -893,9 +902,11 @@ static ssize_t bh1770_prox_persistence_store(struct device *dev, ...@@ -893,9 +902,11 @@ static ssize_t bh1770_prox_persistence_store(struct device *dev,
{ {
struct bh1770_chip *chip = dev_get_drvdata(dev); struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
if (value > BH1770_PROX_MAX_PERSISTENCE) if (value > BH1770_PROX_MAX_PERSISTENCE)
return -EINVAL; return -EINVAL;
...@@ -918,9 +929,11 @@ static ssize_t bh1770_prox_abs_thres_store(struct device *dev, ...@@ -918,9 +929,11 @@ static ssize_t bh1770_prox_abs_thres_store(struct device *dev,
{ {
struct bh1770_chip *chip = dev_get_drvdata(dev); struct bh1770_chip *chip = dev_get_drvdata(dev);
unsigned long value; unsigned long value;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
if (value > BH1770_PROX_RANGE) if (value > BH1770_PROX_RANGE)
return -EINVAL; return -EINVAL;
...@@ -963,9 +976,11 @@ static ssize_t bh1770_lux_calib_store(struct device *dev, ...@@ -963,9 +976,11 @@ static ssize_t bh1770_lux_calib_store(struct device *dev,
unsigned long value; unsigned long value;
u32 old_calib; u32 old_calib;
u32 new_corr; u32 new_corr;
int ret;
if (strict_strtoul(buf, 0, &value)) ret = kstrtoul(buf, 0, &value);
return -EINVAL; if (ret)
return ret;
mutex_lock(&chip->mutex); mutex_lock(&chip->mutex);
old_calib = chip->lux_calib; old_calib = chip->lux_calib;
...@@ -1012,8 +1027,9 @@ static ssize_t bh1770_set_lux_rate(struct device *dev, ...@@ -1012,8 +1027,9 @@ static ssize_t bh1770_set_lux_rate(struct device *dev,
unsigned long rate_hz; unsigned long rate_hz;
int ret, i; int ret, i;
if (strict_strtoul(buf, 0, &rate_hz)) ret = kstrtoul(buf, 0, &rate_hz);
return -EINVAL; if (ret)
return ret;
for (i = 0; i < ARRAY_SIZE(lux_rates_hz) - 1; i++) for (i = 0; i < ARRAY_SIZE(lux_rates_hz) - 1; i++)
if (rate_hz >= lux_rates_hz[i]) if (rate_hz >= lux_rates_hz[i])
...@@ -1047,11 +1063,12 @@ static ssize_t bh1770_get_lux_thresh_below(struct device *dev, ...@@ -1047,11 +1063,12 @@ static ssize_t bh1770_get_lux_thresh_below(struct device *dev,
static ssize_t bh1770_set_lux_thresh(struct bh1770_chip *chip, u16 *target, static ssize_t bh1770_set_lux_thresh(struct bh1770_chip *chip, u16 *target,
const char *buf) const char *buf)
{ {
int ret = 0;
unsigned long thresh; unsigned long thresh;
int ret;
if (strict_strtoul(buf, 0, &thresh)) ret = kstrtoul(buf, 0, &thresh);
return -EINVAL; if (ret)
return ret;
if (thresh > BH1770_LUX_RANGE) if (thresh > BH1770_LUX_RANGE)
return -EINVAL; return -EINVAL;
......
...@@ -107,7 +107,7 @@ static ssize_t bh1780_store_power_state(struct device *dev, ...@@ -107,7 +107,7 @@ static ssize_t bh1780_store_power_state(struct device *dev,
unsigned long val; unsigned long val;
int error; int error;
error = strict_strtoul(buf, 0, &val); error = kstrtoul(buf, 0, &val);
if (error) if (error)
return error; return error;
......
...@@ -830,8 +830,9 @@ static ssize_t penable_store(struct device *dev, struct device_attribute *attr, ...@@ -830,8 +830,9 @@ static ssize_t penable_store(struct device *dev, struct device_attribute *attr,
unsigned long val; unsigned long val;
int ret; int ret;
if (strict_strtoul(buf, 0, &val)) ret = kstrtoul(buf, 0, &val);
return -EINVAL; if (ret)
return ret;
if (val) { if (val) {
ret = fpga_enable_power_supplies(priv); ret = fpga_enable_power_supplies(priv);
...@@ -859,8 +860,9 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr, ...@@ -859,8 +860,9 @@ static ssize_t program_store(struct device *dev, struct device_attribute *attr,
unsigned long val; unsigned long val;
int ret; int ret;
if (strict_strtoul(buf, 0, &val)) ret = kstrtoul(buf, 0, &val);
return -EINVAL; if (ret)
return ret;
/* We can't have an image writer and be programming simultaneously */ /* We can't have an image writer and be programming simultaneously */
if (mutex_lock_interruptible(&priv->lock)) if (mutex_lock_interruptible(&priv->lock))
......
...@@ -1002,10 +1002,10 @@ static ssize_t data_en_set(struct device *dev, struct device_attribute *attr, ...@@ -1002,10 +1002,10 @@ static ssize_t data_en_set(struct device *dev, struct device_attribute *attr,
unsigned long enable; unsigned long enable;
int ret; int ret;
ret = strict_strtoul(buf, 0, &enable); ret = kstrtoul(buf, 0, &enable);
if (ret) { if (ret) {
dev_err(priv->dev, "unable to parse enable input\n"); dev_err(priv->dev, "unable to parse enable input\n");
return -EINVAL; return ret;
} }
/* protect against concurrent enable/disable */ /* protect against concurrent enable/disable */
......
...@@ -46,8 +46,9 @@ static int compass_store(struct device *dev, const char *buf, size_t count, ...@@ -46,8 +46,9 @@ static int compass_store(struct device *dev, const char *buf, size_t count,
int ret; int ret;
unsigned long val; unsigned long val;
if (strict_strtoul(buf, 10, &val)) ret = kstrtoul(buf, 10, &val);
return -EINVAL; if (ret)
return ret;
if (val >= strlen(map)) if (val >= strlen(map))
return -EINVAL; return -EINVAL;
mutex_lock(&compass_mutex); mutex_lock(&compass_mutex);
......
...@@ -208,7 +208,11 @@ static ssize_t isl29003_store_range(struct device *dev, ...@@ -208,7 +208,11 @@ static ssize_t isl29003_store_range(struct device *dev,
unsigned long val; unsigned long val;
int ret; int ret;
if ((strict_strtoul(buf, 10, &val) < 0) || (val > 3)) ret = kstrtoul(buf, 10, &val);
if (ret)
return ret;
if (val > 3)
return -EINVAL; return -EINVAL;
ret = isl29003_set_range(client, val); ret = isl29003_set_range(client, val);
...@@ -239,7 +243,11 @@ static ssize_t isl29003_store_resolution(struct device *dev, ...@@ -239,7 +243,11 @@ static ssize_t isl29003_store_resolution(struct device *dev,
unsigned long val; unsigned long val;
int ret; int ret;
if ((strict_strtoul(buf, 10, &val) < 0) || (val > 3)) ret = kstrtoul(buf, 10, &val);
if (ret)
return ret;
if (val > 3)
return -EINVAL; return -EINVAL;
ret = isl29003_set_resolution(client, val); ret = isl29003_set_resolution(client, val);
...@@ -267,7 +275,11 @@ static ssize_t isl29003_store_mode(struct device *dev, ...@@ -267,7 +275,11 @@ static ssize_t isl29003_store_mode(struct device *dev,
unsigned long val; unsigned long val;
int ret; int ret;
if ((strict_strtoul(buf, 10, &val) < 0) || (val > 2)) ret = kstrtoul(buf, 10, &val);
if (ret)
return ret;
if (val > 2)
return -EINVAL; return -EINVAL;
ret = isl29003_set_mode(client, val); ret = isl29003_set_mode(client, val);
...@@ -298,7 +310,11 @@ static ssize_t isl29003_store_power_state(struct device *dev, ...@@ -298,7 +310,11 @@ static ssize_t isl29003_store_power_state(struct device *dev,
unsigned long val; unsigned long val;
int ret; int ret;
if ((strict_strtoul(buf, 10, &val) < 0) || (val > 1)) ret = kstrtoul(buf, 10, &val);
if (ret)
return ret;
if (val > 1)
return -EINVAL; return -EINVAL;
ret = isl29003_set_power_state(client, val); ret = isl29003_set_power_state(client, val);
......
...@@ -90,8 +90,10 @@ static ssize_t als_sensing_range_store(struct device *dev, ...@@ -90,8 +90,10 @@ static ssize_t als_sensing_range_store(struct device *dev,
int ret_val; int ret_val;
unsigned long val; unsigned long val;
if (strict_strtoul(buf, 10, &val)) ret_val = kstrtoul(buf, 10, &val);
return -EINVAL; if (ret_val)
return ret_val;
if (val < 1 || val > 64000) if (val < 1 || val > 64000)
return -EINVAL; return -EINVAL;
......
...@@ -831,9 +831,11 @@ static ssize_t lis3lv02d_rate_set(struct device *dev, ...@@ -831,9 +831,11 @@ static ssize_t lis3lv02d_rate_set(struct device *dev,
{ {
struct lis3lv02d *lis3 = dev_get_drvdata(dev); struct lis3lv02d *lis3 = dev_get_drvdata(dev);
unsigned long rate; unsigned long rate;
int ret;
if (strict_strtoul(buf, 0, &rate)) ret = kstrtoul(buf, 0, &rate);
return -EINVAL; if (ret)
return ret;
lis3lv02d_sysfs_poweron(lis3); lis3lv02d_sysfs_poweron(lis3);
if (lis3lv02d_set_odr(lis3, rate)) if (lis3lv02d_set_odr(lis3, rate))
......
...@@ -160,15 +160,11 @@ static int options_show(struct seq_file *s, void *p) ...@@ -160,15 +160,11 @@ static int options_show(struct seq_file *s, void *p)
static ssize_t options_write(struct file *file, const char __user *userbuf, static ssize_t options_write(struct file *file, const char __user *userbuf,
size_t count, loff_t *data) size_t count, loff_t *data)
{ {
char buf[20]; int ret;
if (count >= sizeof(buf)) ret = kstrtoul_from_user(userbuf, count, 0, &gru_options);
return -EINVAL; if (ret)
if (copy_from_user(buf, userbuf, count)) return ret;
return -EFAULT;
buf[count] = '\0';
if (strict_strtoul(buf, 0, &gru_options))
return -EINVAL;
return count; return count;
} }
......
...@@ -316,8 +316,12 @@ static ssize_t pcie_gadget_store_no_of_msi( ...@@ -316,8 +316,12 @@ static ssize_t pcie_gadget_store_no_of_msi(
struct spear_pcie_gadget_config *config, struct spear_pcie_gadget_config *config,
const char *buf, size_t count) const char *buf, size_t count)
{ {
if (strict_strtoul(buf, 0, &config->requested_msi)) int ret;
return -EINVAL;
ret = kstrtoul(buf, 0, &config->requested_msi);
if (ret)
return ret;
if (config->requested_msi > 32) if (config->requested_msi > 32)
config->requested_msi = 32; config->requested_msi = 32;
...@@ -330,9 +334,11 @@ static ssize_t pcie_gadget_store_inta( ...@@ -330,9 +334,11 @@ static ssize_t pcie_gadget_store_inta(
{ {
struct pcie_app_reg __iomem *app_reg = config->va_app_base; struct pcie_app_reg __iomem *app_reg = config->va_app_base;
ulong en; ulong en;
int ret;
if (strict_strtoul(buf, 0, &en)) ret = kstrtoul(buf, 0, &en);
return -EINVAL; if (ret)
return ret;
if (en) if (en)
writel(readl(&app_reg->app_ctrl_0) | (1 << SYS_INT_ID), writel(readl(&app_reg->app_ctrl_0) | (1 << SYS_INT_ID),
...@@ -351,9 +357,11 @@ static ssize_t pcie_gadget_store_send_msi( ...@@ -351,9 +357,11 @@ static ssize_t pcie_gadget_store_send_msi(
struct pcie_app_reg __iomem *app_reg = config->va_app_base; struct pcie_app_reg __iomem *app_reg = config->va_app_base;
ulong vector; ulong vector;
u32 ven_msi; u32 ven_msi;
int ret;
if (strict_strtoul(buf, 0, &vector)) ret = kstrtoul(buf, 0, &vector);
return -EINVAL; if (ret)
return ret;
if (!config->configured_msi) if (!config->configured_msi)
return -EINVAL; return -EINVAL;
...@@ -395,9 +403,11 @@ static ssize_t pcie_gadget_store_vendor_id( ...@@ -395,9 +403,11 @@ static ssize_t pcie_gadget_store_vendor_id(
const char *buf, size_t count) const char *buf, size_t count)
{ {
ulong id; ulong id;
int ret;
if (strict_strtoul(buf, 0, &id)) ret = kstrtoul(buf, 0, &id);
return -EINVAL; if (ret)
return ret;
spear_dbi_write_reg(config, PCI_VENDOR_ID, 2, id); spear_dbi_write_reg(config, PCI_VENDOR_ID, 2, id);
...@@ -420,9 +430,11 @@ static ssize_t pcie_gadget_store_device_id( ...@@ -420,9 +430,11 @@ static ssize_t pcie_gadget_store_device_id(
const char *buf, size_t count) const char *buf, size_t count)
{ {
ulong id; ulong id;
int ret;
if (strict_strtoul(buf, 0, &id)) ret = kstrtoul(buf, 0, &id);
return -EINVAL; if (ret)
return ret;
spear_dbi_write_reg(config, PCI_DEVICE_ID, 2, id); spear_dbi_write_reg(config, PCI_DEVICE_ID, 2, id);
...@@ -443,9 +455,12 @@ static ssize_t pcie_gadget_store_bar0_size( ...@@ -443,9 +455,12 @@ static ssize_t pcie_gadget_store_bar0_size(
ulong size; ulong size;
u32 pos, pos1; u32 pos, pos1;
u32 no_of_bit = 0; u32 no_of_bit = 0;
int ret;
ret = kstrtoul(buf, 0, &size);
if (ret)
return ret;
if (strict_strtoul(buf, 0, &size))
return -EINVAL;
/* min bar size is 256 */ /* min bar size is 256 */
if (size <= 0x100) if (size <= 0x100)
size = 0x100; size = 0x100;
...@@ -490,9 +505,11 @@ static ssize_t pcie_gadget_store_bar0_address( ...@@ -490,9 +505,11 @@ static ssize_t pcie_gadget_store_bar0_address(
{ {
struct pcie_app_reg __iomem *app_reg = config->va_app_base; struct pcie_app_reg __iomem *app_reg = config->va_app_base;
ulong address; ulong address;
int ret;
if (strict_strtoul(buf, 0, &address)) ret = kstrtoul(buf, 0, &address);
return -EINVAL; if (ret)
return ret;
address &= ~(config->bar0_size - 1); address &= ~(config->bar0_size - 1);
if (config->va_bar0_address) if (config->va_bar0_address)
...@@ -518,9 +535,11 @@ static ssize_t pcie_gadget_store_bar0_rw_offset( ...@@ -518,9 +535,11 @@ static ssize_t pcie_gadget_store_bar0_rw_offset(
const char *buf, size_t count) const char *buf, size_t count)
{ {
ulong offset; ulong offset;
int ret;
if (strict_strtoul(buf, 0, &offset)) ret = kstrtoul(buf, 0, &offset);
return -EINVAL; if (ret)
return ret;
if (offset % 4) if (offset % 4)
return -EINVAL; return -EINVAL;
...@@ -549,9 +568,11 @@ static ssize_t pcie_gadget_store_bar0_data( ...@@ -549,9 +568,11 @@ static ssize_t pcie_gadget_store_bar0_data(
const char *buf, size_t count) const char *buf, size_t count)
{ {
ulong data; ulong data;
int ret;
if (strict_strtoul(buf, 0, &data)) ret = kstrtoul(buf, 0, &data);
return -EINVAL; if (ret)
return ret;
if (!config->va_bar0_address) if (!config->va_bar0_address)
return -ENOMEM; return -ENOMEM;
......
...@@ -33,9 +33,11 @@ static ssize_t dac7512_store_val(struct device *dev, ...@@ -33,9 +33,11 @@ static ssize_t dac7512_store_val(struct device *dev,
struct spi_device *spi = to_spi_device(dev); struct spi_device *spi = to_spi_device(dev);
unsigned char tmp[2]; unsigned char tmp[2];
unsigned long val; unsigned long val;
int ret;
if (strict_strtoul(buf, 10, &val) < 0) ret = kstrtoul(buf, 10, &val);
return -EINVAL; if (ret)
return ret;
tmp[0] = val >> 8; tmp[0] = val >> 8;
tmp[1] = val & 0xff; tmp[1] = val & 0xff;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment