ppc4xx: replace sscanf() by kstrtoul()
Fix the checkpatch.pl warning: "Prefer kstrto<type> to single variable sscanf". Signed-off-by: Salah Triki <salah.triki@gmail.com> Link: https://lore.kernel.org/r/20210710165432.GA690401@pc Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Родитель
2b5b74054c
Коммит
48ae638be5
|
@ -4319,6 +4319,7 @@ static ssize_t enable_store(struct device_driver *dev, const char *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (!count || count > 11)
|
if (!count || count > 11)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -4327,7 +4328,10 @@ static ssize_t enable_store(struct device_driver *dev, const char *buf,
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/* Write a key */
|
/* Write a key */
|
||||||
sscanf(buf, "%lx", &val);
|
err = kstrtoul(buf, 16, &val);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
dcr_write(ppc440spe_mq_dcr_host, DCRN_MQ0_XORBA, val);
|
dcr_write(ppc440spe_mq_dcr_host, DCRN_MQ0_XORBA, val);
|
||||||
isync();
|
isync();
|
||||||
|
|
||||||
|
@ -4368,7 +4372,7 @@ static ssize_t poly_store(struct device_driver *dev, const char *buf,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
unsigned long reg, val;
|
unsigned long reg, val;
|
||||||
|
int err;
|
||||||
#ifdef CONFIG_440SP
|
#ifdef CONFIG_440SP
|
||||||
/* 440SP uses default 0x14D polynomial only */
|
/* 440SP uses default 0x14D polynomial only */
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -4378,7 +4382,9 @@ static ssize_t poly_store(struct device_driver *dev, const char *buf,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* e.g., 0x14D or 0x11D */
|
/* e.g., 0x14D or 0x11D */
|
||||||
sscanf(buf, "%lx", &val);
|
err = kstrtoul(buf, 16, &val);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
if (val & ~0x1FF)
|
if (val & ~0x1FF)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче