Skip to content

Commit 36cd428

Browse files
gcabiddugregkh
authored andcommitted
crypto: qat - fix type mismatch in RAS sysfs show functions
[ Upstream commit ec23d75 ] ADF_RAS_ERR_CTR_READ() expands to atomic_read(), which returns int. The local variable 'counter' was declared as 'unsigned long', causing a type mismatch on the assignment. The format specifier '%ld' was consequently wrong in two ways: wrong length modifier and wrong signedness. Use int to match the return type of atomic_read() and update the format specifier to '%d' accordingly. Fixes: 532d7f6 ("crypto: qat - add error counters") Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Ahsan Atta <ahsan.atta@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d48fd28 commit 36cd428

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,44 @@ static ssize_t errors_correctable_show(struct device *dev,
1313
char *buf)
1414
{
1515
struct adf_accel_dev *accel_dev;
16-
unsigned long counter;
16+
int counter;
1717

1818
accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
1919
if (!accel_dev)
2020
return -EINVAL;
2121

2222
counter = ADF_RAS_ERR_CTR_READ(accel_dev->ras_errors, ADF_RAS_CORR);
23-
return scnprintf(buf, PAGE_SIZE, "%ld\n", counter);
23+
return scnprintf(buf, PAGE_SIZE, "%d\n", counter);
2424
}
2525

2626
static ssize_t errors_nonfatal_show(struct device *dev,
2727
struct device_attribute *dev_attr,
2828
char *buf)
2929
{
3030
struct adf_accel_dev *accel_dev;
31-
unsigned long counter;
31+
int counter;
3232

3333
accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
3434
if (!accel_dev)
3535
return -EINVAL;
3636

3737
counter = ADF_RAS_ERR_CTR_READ(accel_dev->ras_errors, ADF_RAS_UNCORR);
38-
return scnprintf(buf, PAGE_SIZE, "%ld\n", counter);
38+
return scnprintf(buf, PAGE_SIZE, "%d\n", counter);
3939
}
4040

4141
static ssize_t errors_fatal_show(struct device *dev,
4242
struct device_attribute *dev_attr,
4343
char *buf)
4444
{
4545
struct adf_accel_dev *accel_dev;
46-
unsigned long counter;
46+
int counter;
4747

4848
accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
4949
if (!accel_dev)
5050
return -EINVAL;
5151

5252
counter = ADF_RAS_ERR_CTR_READ(accel_dev->ras_errors, ADF_RAS_FATAL);
53-
return scnprintf(buf, PAGE_SIZE, "%ld\n", counter);
53+
return scnprintf(buf, PAGE_SIZE, "%d\n", counter);
5454
}
5555

5656
static ssize_t reset_error_counters_store(struct device *dev,

0 commit comments

Comments
 (0)