Re: [PATCH v2] Expose PCIe SSD Status LED Management DSM in sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stuart,

url:    https://github.com/0day-ci/linux/commits/Stuart-Hayes/Expose-PCIe-SSD-Status-LED-Management-DSM-in-sysfs/20201111-004557
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: i386-randconfig-m021-20201111 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/pci/pci-ssdleds.c:47 ssdleds_dsm_set() warn: impossible condition '(val > (~0)) => (0-u32max > u32max)'

vim +47 drivers/pci/pci-ssdleds.c

e6eac5bf04a7aca Stuart Hayes 2020-11-10  34  static int ssdleds_dsm_set(struct device *dev, const char *buf, u64 dsm_func)
e6eac5bf04a7aca Stuart Hayes 2020-11-10  35  {
e6eac5bf04a7aca Stuart Hayes 2020-11-10  36  	acpi_handle handle;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  37  	union acpi_object *out_obj, arg3[2];
e6eac5bf04a7aca Stuart Hayes 2020-11-10  38  	struct pci_ssdleds_dsm_output *dsm_output;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  39  	u32 val;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  40  	int err;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  41  
e6eac5bf04a7aca Stuart Hayes 2020-11-10  42  	handle = ACPI_HANDLE(dev);
e6eac5bf04a7aca Stuart Hayes 2020-11-10  43  	if (!handle)
e6eac5bf04a7aca Stuart Hayes 2020-11-10  44  		return -ENODEV;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  45  
e6eac5bf04a7aca Stuart Hayes 2020-11-10  46  	err = kstrtou32(buf, 0, &val);
e6eac5bf04a7aca Stuart Hayes 2020-11-10 @47  	if (err || val > U32_MAX)
                                                           ^^^^^^^^^^^^^
This is not required.  Just "if (err) return err;"'

e6eac5bf04a7aca Stuart Hayes 2020-11-10  48  		return -EINVAL;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  49  
e6eac5bf04a7aca Stuart Hayes 2020-11-10  50  	arg3[0].type = ACPI_TYPE_PACKAGE;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  51  	arg3[0].package.count = 1;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  52  	arg3[0].package.elements = &arg3[1];
e6eac5bf04a7aca Stuart Hayes 2020-11-10  53  
e6eac5bf04a7aca Stuart Hayes 2020-11-10  54  	arg3[1].type = ACPI_TYPE_BUFFER;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  55  	arg3[1].buffer.length = 4;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  56  	arg3[1].buffer.pointer = (u8 *)&val;
e6eac5bf04a7aca Stuart Hayes 2020-11-10  57  
e6eac5bf04a7aca Stuart Hayes 2020-11-10  58  	out_obj = acpi_evaluate_dsm_typed(handle, &pci_ssdleds_dsm_guid, 0x1,

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux