Merge tag 'char-misc-6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc/iio driver fixes from Greg KH:
"Here are some small char/misc/iio and some other minor driver
subsystem fixes for 6.19-rc7. Nothing huge here, just some fixes for
reported issues including:

- lots of little iio driver fixes

- comedi driver fixes

- mux driver fix

- w1 driver fixes

- uio driver fix

- slimbus driver fixes

- hwtracing bugfix

- other tiny bugfixes

All of these have been in linux-next for a while with no reported
issues"

* tag 'char-misc-6.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (36 commits)
comedi: dmm32at: serialize use of paged registers
mei: trace: treat reg parameter as string
uio: pci_sva: correct '-ENODEV' check logic
uacce: ensure safe queue release with state management
uacce: implement mremap in uacce_vm_ops to return -EPERM
uacce: fix isolate sysfs check condition
uacce: fix cdev handling in the cleanup path
slimbus: core: clean up of_slim_get_device()
slimbus: core: fix of_slim_get_device() kernel doc
slimbus: core: amend slim_get_device() kernel doc
slimbus: core: fix device reference leak on report present
slimbus: core: fix runtime PM imbalance on report present
slimbus: core: fix OF node leak on registration failure
intel_th: rename error label
intel_th: fix device leak on output open()
comedi: Fix getting range information for subdevices 16 to 255
mux: mmio: Fix IS_ERR() vs NULL check in probe()
interconnect: debugfs: initialize src_node and dst_node to empty strings
iio: dac: ad3552r-hs: fix out-of-bound write in ad3552r_hs_write_data_source
iio: accel: iis328dq: fix gain values
...

+312 -138
+31
Documentation/devicetree/bindings/interconnect/qcom,sa8775p-rpmh.yaml
··· 74 74 - description: aggre UFS CARD AXI clock 75 75 - description: RPMH CC IPA clock 76 76 77 + - if: 78 + properties: 79 + compatible: 80 + contains: 81 + enum: 82 + - qcom,sa8775p-config-noc 83 + - qcom,sa8775p-dc-noc 84 + - qcom,sa8775p-gem-noc 85 + - qcom,sa8775p-gpdsp-anoc 86 + - qcom,sa8775p-lpass-ag-noc 87 + - qcom,sa8775p-mmss-noc 88 + - qcom,sa8775p-nspa-noc 89 + - qcom,sa8775p-nspb-noc 90 + - qcom,sa8775p-pcie-anoc 91 + - qcom,sa8775p-system-noc 92 + then: 93 + properties: 94 + clocks: false 95 + 96 + - if: 97 + properties: 98 + compatible: 99 + contains: 100 + enum: 101 + - qcom,sa8775p-clk-virt 102 + - qcom,sa8775p-mc-virt 103 + then: 104 + properties: 105 + reg: false 106 + clocks: false 107 + 77 108 unevaluatedProperties: false 78 109 79 110 examples:
+1
MAINTAINERS
··· 13172 13172 F: Documentation/driver-api/interconnect.rst 13173 13173 F: drivers/interconnect/ 13174 13174 F: include/dt-bindings/interconnect/ 13175 + F: include/linux/interconnect-clk.h 13175 13176 F: include/linux/interconnect-provider.h 13176 13177 F: include/linux/interconnect.h 13177 13178
+1 -1
drivers/comedi/comedi_fops.c
··· 1155 1155 for (i = 0; i < s->n_chan; i++) { 1156 1156 int x; 1157 1157 1158 - x = (dev->minor << 28) | (it->subdev << 24) | (i << 16) | 1158 + x = (it->subdev << 24) | (i << 16) | 1159 1159 (s->range_table_list[i]->length); 1160 1160 if (put_user(x, it->rangelist + i)) 1161 1161 return -EFAULT;
+30 -2
drivers/comedi/drivers/dmm32at.c
··· 330 330 331 331 static void dmm32at_setaitimer(struct comedi_device *dev, unsigned int nansec) 332 332 { 333 + unsigned long irq_flags; 333 334 unsigned char lo1, lo2, hi2; 334 335 unsigned short both2; 335 336 ··· 342 341 343 342 /* set counter clocks to 10MHz, disable all aux dio */ 344 343 outb(0, dev->iobase + DMM32AT_CTRDIO_CFG_REG); 344 + 345 + /* serialize access to control register and paged registers */ 346 + spin_lock_irqsave(&dev->spinlock, irq_flags); 345 347 346 348 /* get access to the clock regs */ 347 349 outb(DMM32AT_CTRL_PAGE_8254, dev->iobase + DMM32AT_CTRL_REG); ··· 358 354 outb(lo2, dev->iobase + DMM32AT_CLK2); 359 355 outb(hi2, dev->iobase + DMM32AT_CLK2); 360 356 357 + spin_unlock_irqrestore(&dev->spinlock, irq_flags); 358 + 361 359 /* enable the ai conversion interrupt and the clock to start scans */ 362 360 outb(DMM32AT_INTCLK_ADINT | 363 361 DMM32AT_INTCLK_CLKEN | DMM32AT_INTCLK_CLKSEL, ··· 369 363 static int dmm32at_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) 370 364 { 371 365 struct comedi_cmd *cmd = &s->async->cmd; 366 + unsigned long irq_flags; 372 367 int ret; 373 368 374 369 dmm32at_ai_set_chanspec(dev, s, cmd->chanlist[0], cmd->chanlist_len); 375 370 371 + /* serialize access to control register and paged registers */ 372 + spin_lock_irqsave(&dev->spinlock, irq_flags); 373 + 376 374 /* reset the interrupt just in case */ 377 375 outb(DMM32AT_CTRL_INTRST, dev->iobase + DMM32AT_CTRL_REG); 376 + 377 + spin_unlock_irqrestore(&dev->spinlock, irq_flags); 378 378 379 379 /* 380 380 * wait for circuit to settle ··· 441 429 comedi_handle_events(dev, s); 442 430 } 443 431 432 + /* serialize access to control register and paged registers */ 433 + spin_lock(&dev->spinlock); 434 + 444 435 /* reset the interrupt */ 445 436 outb(DMM32AT_CTRL_INTRST, dev->iobase + DMM32AT_CTRL_REG); 437 + 438 + spin_unlock(&dev->spinlock); 446 439 return IRQ_HANDLED; 447 440 } 448 441 ··· 498 481 static int dmm32at_8255_io(struct comedi_device *dev, 499 482 int dir, int port, int data, unsigned long regbase) 500 483 { 484 + unsigned long irq_flags; 485 + int ret; 486 + 487 + /* serialize access to control register and paged registers */ 488 + spin_lock_irqsave(&dev->spinlock, irq_flags); 489 + 501 490 /* get access to the DIO regs */ 502 491 outb(DMM32AT_CTRL_PAGE_8255, dev->iobase + DMM32AT_CTRL_REG); 503 492 504 493 if (dir) { 505 494 outb(data, dev->iobase + regbase + port); 506 - return 0; 495 + ret = 0; 496 + } else { 497 + ret = inb(dev->iobase + regbase + port); 507 498 } 508 - return inb(dev->iobase + regbase + port); 499 + 500 + spin_unlock_irqrestore(&dev->spinlock, irq_flags); 501 + 502 + return ret; 509 503 } 510 504 511 505 /* Make sure the board is there and put it to a known state */
+1 -1
drivers/comedi/range.c
··· 52 52 const struct comedi_lrange *lr; 53 53 struct comedi_subdevice *s; 54 54 55 - subd = (it->range_type >> 24) & 0xf; 55 + subd = (it->range_type >> 24) & 0xff; 56 56 chan = (it->range_type >> 16) & 0xff; 57 57 58 58 if (!dev->attached)
+19 -6
drivers/hwtracing/intel_th/core.c
··· 810 810 int err; 811 811 812 812 dev = bus_find_device_by_devt(&intel_th_bus, inode->i_rdev); 813 - if (!dev || !dev->driver) { 813 + if (!dev) 814 + return -ENODEV; 815 + 816 + if (!dev->driver) { 814 817 err = -ENODEV; 815 - goto out_no_device; 818 + goto err_put_dev; 816 819 } 817 820 818 821 thdrv = to_intel_th_driver(dev->driver); 819 822 fops = fops_get(thdrv->fops); 820 823 if (!fops) { 821 824 err = -ENODEV; 822 - goto out_put_device; 825 + goto err_put_dev; 823 826 } 824 827 825 828 replace_fops(file, fops); ··· 832 829 if (file->f_op->open) { 833 830 err = file->f_op->open(inode, file); 834 831 if (err) 835 - goto out_put_device; 832 + goto err_put_dev; 836 833 } 837 834 838 835 return 0; 839 836 840 - out_put_device: 837 + err_put_dev: 841 838 put_device(dev); 842 - out_no_device: 839 + 843 840 return err; 841 + } 842 + 843 + static int intel_th_output_release(struct inode *inode, struct file *file) 844 + { 845 + struct intel_th_device *thdev = file->private_data; 846 + 847 + put_device(&thdev->dev); 848 + 849 + return 0; 844 850 } 845 851 846 852 static const struct file_operations intel_th_output_fops = { 847 853 .open = intel_th_output_open, 854 + .release = intel_th_output_release, 848 855 .llseek = noop_llseek, 849 856 }; 850 857
+3 -3
drivers/iio/accel/adxl380.c
··· 1784 1784 st->int_map[1] = ADXL380_INT0_MAP1_REG; 1785 1785 } else { 1786 1786 st->irq = fwnode_irq_get_byname(dev_fwnode(st->dev), "INT1"); 1787 - if (st->irq > 0) 1788 - return dev_err_probe(st->dev, -ENODEV, 1789 - "no interrupt name specified"); 1787 + if (st->irq < 0) 1788 + return dev_err_probe(st->dev, st->irq, 1789 + "no interrupt name specified\n"); 1790 1790 st->int_map[0] = ADXL380_INT1_MAP0_REG; 1791 1791 st->int_map[1] = ADXL380_INT1_MAP1_REG; 1792 1792 }
+71 -1
drivers/iio/accel/st_accel_core.c
··· 517 517 .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, 518 518 .sensors_supported = { 519 519 [0] = H3LIS331DL_ACCEL_DEV_NAME, 520 - [1] = IIS328DQ_ACCEL_DEV_NAME, 521 520 }, 522 521 .ch = (struct iio_chan_spec *)st_accel_12bit_channels, 523 522 .odr = { ··· 557 558 .num = ST_ACCEL_FS_AVL_400G, 558 559 .value = 0x03, 559 560 .gain = IIO_G_TO_M_S_2(195000), 561 + }, 562 + }, 563 + }, 564 + .bdu = { 565 + .addr = 0x23, 566 + .mask = 0x80, 567 + }, 568 + .drdy_irq = { 569 + .int1 = { 570 + .addr = 0x22, 571 + .mask = 0x02, 572 + }, 573 + .int2 = { 574 + .addr = 0x22, 575 + .mask = 0x10, 576 + }, 577 + .addr_ihl = 0x22, 578 + .mask_ihl = 0x80, 579 + }, 580 + .sim = { 581 + .addr = 0x23, 582 + .value = BIT(0), 583 + }, 584 + .multi_read_bit = true, 585 + .bootime = 2, 586 + }, 587 + { 588 + .wai = 0x32, 589 + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS, 590 + .sensors_supported = { 591 + [0] = IIS328DQ_ACCEL_DEV_NAME, 592 + }, 593 + .ch = (struct iio_chan_spec *)st_accel_12bit_channels, 594 + .odr = { 595 + .addr = 0x20, 596 + .mask = 0x18, 597 + .odr_avl = { 598 + { .hz = 50, .value = 0x00, }, 599 + { .hz = 100, .value = 0x01, }, 600 + { .hz = 400, .value = 0x02, }, 601 + { .hz = 1000, .value = 0x03, }, 602 + }, 603 + }, 604 + .pw = { 605 + .addr = 0x20, 606 + .mask = 0x20, 607 + .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE, 608 + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, 609 + }, 610 + .enable_axis = { 611 + .addr = ST_SENSORS_DEFAULT_AXIS_ADDR, 612 + .mask = ST_SENSORS_DEFAULT_AXIS_MASK, 613 + }, 614 + .fs = { 615 + .addr = 0x23, 616 + .mask = 0x30, 617 + .fs_avl = { 618 + [0] = { 619 + .num = ST_ACCEL_FS_AVL_100G, 620 + .value = 0x00, 621 + .gain = IIO_G_TO_M_S_2(980), 622 + }, 623 + [1] = { 624 + .num = ST_ACCEL_FS_AVL_200G, 625 + .value = 0x01, 626 + .gain = IIO_G_TO_M_S_2(1950), 627 + }, 628 + [2] = { 629 + .num = ST_ACCEL_FS_AVL_400G, 630 + .value = 0x03, 631 + .gain = IIO_G_TO_M_S_2(3910), 560 632 }, 561 633 }, 562 634 },
+3 -1
drivers/iio/adc/ad7280a.c
··· 1024 1024 1025 1025 st->spi->max_speed_hz = AD7280A_MAX_SPI_CLK_HZ; 1026 1026 st->spi->mode = SPI_MODE_1; 1027 - spi_setup(st->spi); 1027 + ret = spi_setup(st->spi); 1028 + if (ret < 0) 1029 + return ret; 1028 1030 1029 1031 st->ctrl_lb = FIELD_PREP(AD7280A_CTRL_LB_ACQ_TIME_MSK, st->acquisition_time) | 1030 1032 FIELD_PREP(AD7280A_CTRL_LB_THERMISTOR_MSK, st->thermistor_term_en);
+2 -1
drivers/iio/adc/ad7606_par.c
··· 43 43 struct iio_dev *indio_dev) 44 44 { 45 45 struct ad7606_state *st = iio_priv(indio_dev); 46 - unsigned int ret, c; 46 + unsigned int c; 47 + int ret; 47 48 struct iio_backend_data_fmt data = { 48 49 .sign_extend = true, 49 50 .enable = true,
+1 -1
drivers/iio/adc/ad9467.c
··· 95 95 96 96 #define CHIPID_AD9434 0x6A 97 97 #define AD9434_DEF_OUTPUT_MODE 0x00 98 - #define AD9434_REG_VREF_MASK 0xC0 98 + #define AD9434_REG_VREF_MASK GENMASK(4, 0) 99 99 100 100 /* 101 101 * Analog Devices AD9467 16-Bit, 200/250 MSPS ADC
+1
drivers/iio/adc/at91-sama5d2_adc.c
··· 2481 2481 struct at91_adc_state *st = iio_priv(indio_dev); 2482 2482 2483 2483 iio_device_unregister(indio_dev); 2484 + cancel_work_sync(&st->touch_st.workq); 2484 2485 2485 2486 at91_adc_dma_disable(st); 2486 2487
+2 -13
drivers/iio/adc/exynos_adc.c
··· 540 540 ADC_CHANNEL(9, "adc9"), 541 541 }; 542 542 543 - static int exynos_adc_remove_devices(struct device *dev, void *c) 544 - { 545 - struct platform_device *pdev = to_platform_device(dev); 546 - 547 - platform_device_unregister(pdev); 548 - 549 - return 0; 550 - } 551 - 552 543 static int exynos_adc_probe(struct platform_device *pdev) 553 544 { 554 545 struct exynos_adc *info = NULL; ··· 651 660 return 0; 652 661 653 662 err_of_populate: 654 - device_for_each_child(&indio_dev->dev, NULL, 655 - exynos_adc_remove_devices); 663 + of_platform_depopulate(&indio_dev->dev); 656 664 iio_device_unregister(indio_dev); 657 665 err_irq: 658 666 free_irq(info->irq, info); ··· 671 681 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 672 682 struct exynos_adc *info = iio_priv(indio_dev); 673 683 674 - device_for_each_child(&indio_dev->dev, NULL, 675 - exynos_adc_remove_devices); 684 + of_platform_depopulate(&indio_dev->dev); 676 685 iio_device_unregister(indio_dev); 677 686 free_irq(info->irq, info); 678 687 if (info->data->exit_hw)
+3 -3
drivers/iio/adc/pac1934.c
··· 665 665 /* add the power_acc field */ 666 666 curr_energy += inc; 667 667 668 - clamp(curr_energy, PAC_193X_MIN_POWER_ACC, PAC_193X_MAX_POWER_ACC); 669 - 670 - reg_data->energy_sec_acc[cnt] = curr_energy; 668 + reg_data->energy_sec_acc[cnt] = clamp(curr_energy, 669 + PAC_193X_MIN_POWER_ACC, 670 + PAC_193X_MAX_POWER_ACC); 671 671 } 672 672 673 673 offset_reg_data_p += PAC1934_VPOWER_ACC_REG_LEN;
+3 -3
drivers/iio/chemical/scd4x.c
··· 584 584 .sign = 'u', 585 585 .realbits = 16, 586 586 .storagebits = 16, 587 - .endianness = IIO_BE, 587 + .endianness = IIO_CPU, 588 588 }, 589 589 }, 590 590 { ··· 599 599 .sign = 'u', 600 600 .realbits = 16, 601 601 .storagebits = 16, 602 - .endianness = IIO_BE, 602 + .endianness = IIO_CPU, 603 603 }, 604 604 }, 605 605 { ··· 612 612 .sign = 'u', 613 613 .realbits = 16, 614 614 .storagebits = 16, 615 - .endianness = IIO_BE, 615 + .endianness = IIO_CPU, 616 616 }, 617 617 }, 618 618 };
+4 -1
drivers/iio/dac/ad3552r-hs.c
··· 549 549 550 550 guard(mutex)(&st->lock); 551 551 552 + if (count >= sizeof(buf)) 553 + return -ENOSPC; 554 + 552 555 ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf, 553 556 count); 554 557 if (ret < 0) 555 558 return ret; 556 559 557 - buf[count] = '\0'; 560 + buf[ret] = '\0'; 558 561 559 562 ret = match_string(dbgfs_attr_source, ARRAY_SIZE(dbgfs_attr_source), 560 563 buf);
+6
drivers/iio/dac/ad5686.c
··· 434 434 .num_channels = 4, 435 435 .regmap_type = AD5686_REGMAP, 436 436 }, 437 + [ID_AD5695R] = { 438 + .channels = ad5685r_channels, 439 + .int_vref_mv = 2500, 440 + .num_channels = 4, 441 + .regmap_type = AD5686_REGMAP, 442 + }, 437 443 [ID_AD5696] = { 438 444 .channels = ad5686_channels, 439 445 .num_channels = 4,
+5 -4
drivers/iio/imu/inv_icm45600/inv_icm45600_core.c
··· 960 960 return IIO_VAL_INT; 961 961 /* 962 962 * T°C = (temp / 128) + 25 963 - * Tm°C = 1000 * ((temp * 100 / 12800) + 25) 964 - * scale: 100000 / 13248 = 7.8125 965 - * offset: 25000 963 + * Tm°C = ((temp + 25 * 128) / 128)) * 1000 964 + * Tm°C = (temp + 3200) * (1000 / 128) 965 + * scale: 1000 / 128 = 7.8125 966 + * offset: 3200 966 967 */ 967 968 case IIO_CHAN_INFO_SCALE: 968 969 *val = 7; 969 970 *val2 = 812500; 970 971 return IIO_VAL_INT_PLUS_MICRO; 971 972 case IIO_CHAN_INFO_OFFSET: 972 - *val = 25000; 973 + *val = 3200; 973 974 return IIO_VAL_INT; 974 975 default: 975 976 return -EINVAL;
+11 -4
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
··· 101 101 IIO_CHAN_SOFT_TIMESTAMP(3), 102 102 }; 103 103 104 + static const struct iio_chan_spec st_lsm6ds0_acc_channels[] = { 105 + ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x28, IIO_MOD_X, 0), 106 + ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x2a, IIO_MOD_Y, 1), 107 + ST_LSM6DSX_CHANNEL(IIO_ACCEL, 0x2c, IIO_MOD_Z, 2), 108 + IIO_CHAN_SOFT_TIMESTAMP(3), 109 + }; 110 + 104 111 static const struct iio_chan_spec st_lsm6dsx_gyro_channels[] = { 105 112 ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, 0x22, IIO_MOD_X, 0), 106 113 ST_LSM6DSX_CHANNEL(IIO_ANGL_VEL, 0x24, IIO_MOD_Y, 1), ··· 149 142 }, 150 143 .channels = { 151 144 [ST_LSM6DSX_ID_ACC] = { 152 - .chan = st_lsm6dsx_acc_channels, 153 - .len = ARRAY_SIZE(st_lsm6dsx_acc_channels), 145 + .chan = st_lsm6ds0_acc_channels, 146 + .len = ARRAY_SIZE(st_lsm6ds0_acc_channels), 154 147 }, 155 148 [ST_LSM6DSX_ID_GYRO] = { 156 149 .chan = st_lsm6ds0_gyro_channels, ··· 1456 1449 }, 1457 1450 .channels = { 1458 1451 [ST_LSM6DSX_ID_ACC] = { 1459 - .chan = st_lsm6dsx_acc_channels, 1460 - .len = ARRAY_SIZE(st_lsm6dsx_acc_channels), 1452 + .chan = st_lsm6ds0_acc_channels, 1453 + .len = ARRAY_SIZE(st_lsm6ds0_acc_channels), 1461 1454 }, 1462 1455 [ST_LSM6DSX_ID_GYRO] = { 1463 1456 .chan = st_lsm6dsx_gyro_channels,
+3 -1
drivers/iio/industrialio-core.c
··· 1657 1657 mutex_destroy(&iio_dev_opaque->info_exist_lock); 1658 1658 mutex_destroy(&iio_dev_opaque->mlock); 1659 1659 1660 + lockdep_unregister_key(&iio_dev_opaque->info_exist_key); 1660 1661 lockdep_unregister_key(&iio_dev_opaque->mlock_key); 1661 1662 1662 1663 ida_free(&iio_ida, iio_dev_opaque->id); ··· 1718 1717 INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers); 1719 1718 1720 1719 lockdep_register_key(&iio_dev_opaque->mlock_key); 1720 + lockdep_register_key(&iio_dev_opaque->info_exist_key); 1721 1721 1722 1722 mutex_init_with_key(&iio_dev_opaque->mlock, &iio_dev_opaque->mlock_key); 1723 - mutex_init(&iio_dev_opaque->info_exist_lock); 1723 + mutex_init_with_key(&iio_dev_opaque->info_exist_lock, &iio_dev_opaque->info_exist_key); 1724 1724 1725 1725 indio_dev->dev.parent = parent; 1726 1726 indio_dev->dev.type = &iio_device_type;
+5
drivers/interconnect/debugfs-client.c
··· 150 150 return ret; 151 151 } 152 152 153 + src_node = devm_kstrdup(&pdev->dev, "", GFP_KERNEL); 154 + dst_node = devm_kstrdup(&pdev->dev, "", GFP_KERNEL); 155 + if (!src_node || !dst_node) 156 + return -ENOMEM; 157 + 153 158 client_dir = debugfs_create_dir("test_client", icc_dir); 154 159 155 160 debugfs_create_str("src_node", 0600, client_dir, &src_node);
+9 -9
drivers/misc/mei/mei-trace.h
··· 21 21 TP_ARGS(dev, reg, offs, val), 22 22 TP_STRUCT__entry( 23 23 __string(dev, dev_name(dev)) 24 - __field(const char *, reg) 24 + __string(reg, reg) 25 25 __field(u32, offs) 26 26 __field(u32, val) 27 27 ), 28 28 TP_fast_assign( 29 29 __assign_str(dev); 30 - __entry->reg = reg; 30 + __assign_str(reg); 31 31 __entry->offs = offs; 32 32 __entry->val = val; 33 33 ), 34 34 TP_printk("[%s] read %s:[%#x] = %#x", 35 - __get_str(dev), __entry->reg, __entry->offs, __entry->val) 35 + __get_str(dev), __get_str(reg), __entry->offs, __entry->val) 36 36 ); 37 37 38 38 TRACE_EVENT(mei_reg_write, ··· 40 40 TP_ARGS(dev, reg, offs, val), 41 41 TP_STRUCT__entry( 42 42 __string(dev, dev_name(dev)) 43 - __field(const char *, reg) 43 + __string(reg, reg) 44 44 __field(u32, offs) 45 45 __field(u32, val) 46 46 ), 47 47 TP_fast_assign( 48 48 __assign_str(dev); 49 - __entry->reg = reg; 49 + __assign_str(reg); 50 50 __entry->offs = offs; 51 51 __entry->val = val; 52 52 ), 53 53 TP_printk("[%s] write %s[%#x] = %#x", 54 - __get_str(dev), __entry->reg, __entry->offs, __entry->val) 54 + __get_str(dev), __get_str(reg), __entry->offs, __entry->val) 55 55 ); 56 56 57 57 TRACE_EVENT(mei_pci_cfg_read, ··· 59 59 TP_ARGS(dev, reg, offs, val), 60 60 TP_STRUCT__entry( 61 61 __string(dev, dev_name(dev)) 62 - __field(const char *, reg) 62 + __string(reg, reg) 63 63 __field(u32, offs) 64 64 __field(u32, val) 65 65 ), 66 66 TP_fast_assign( 67 67 __assign_str(dev); 68 - __entry->reg = reg; 68 + __assign_str(reg); 69 69 __entry->offs = offs; 70 70 __entry->val = val; 71 71 ), 72 72 TP_printk("[%s] pci cfg read %s:[%#x] = %#x", 73 - __get_str(dev), __entry->reg, __entry->offs, __entry->val) 73 + __get_str(dev), __get_str(reg), __entry->offs, __entry->val) 74 74 ); 75 75 76 76 #endif /* _MEI_TRACE_H_ */
+40 -8
drivers/misc/uacce/uacce.c
··· 40 40 return 0; 41 41 } 42 42 43 - static int uacce_put_queue(struct uacce_queue *q) 43 + static int uacce_stop_queue(struct uacce_queue *q) 44 44 { 45 45 struct uacce_device *uacce = q->uacce; 46 46 47 - if ((q->state == UACCE_Q_STARTED) && uacce->ops->stop_queue) 47 + if (q->state != UACCE_Q_STARTED) 48 + return 0; 49 + 50 + if (uacce->ops->stop_queue) 48 51 uacce->ops->stop_queue(q); 49 52 50 - if ((q->state == UACCE_Q_INIT || q->state == UACCE_Q_STARTED) && 51 - uacce->ops->put_queue) 53 + q->state = UACCE_Q_INIT; 54 + 55 + return 0; 56 + } 57 + 58 + static void uacce_put_queue(struct uacce_queue *q) 59 + { 60 + struct uacce_device *uacce = q->uacce; 61 + 62 + uacce_stop_queue(q); 63 + 64 + if (q->state != UACCE_Q_INIT) 65 + return; 66 + 67 + if (uacce->ops->put_queue) 52 68 uacce->ops->put_queue(q); 53 69 54 70 q->state = UACCE_Q_ZOMBIE; 55 - 56 - return 0; 57 71 } 58 72 59 73 static long uacce_fops_unl_ioctl(struct file *filep, ··· 94 80 ret = uacce_start_queue(q); 95 81 break; 96 82 case UACCE_CMD_PUT_Q: 97 - ret = uacce_put_queue(q); 83 + ret = uacce_stop_queue(q); 98 84 break; 99 85 default: 100 86 if (uacce->ops->ioctl) ··· 228 214 } 229 215 } 230 216 217 + static int uacce_vma_mremap(struct vm_area_struct *area) 218 + { 219 + return -EPERM; 220 + } 221 + 231 222 static const struct vm_operations_struct uacce_vm_ops = { 232 223 .close = uacce_vma_close, 224 + .mremap = uacce_vma_mremap, 233 225 }; 234 226 235 227 static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma) ··· 402 382 struct uacce_device *uacce = to_uacce_device(dev); 403 383 u32 val; 404 384 385 + if (!uacce->ops->isolate_err_threshold_read) 386 + return -ENOENT; 387 + 405 388 val = uacce->ops->isolate_err_threshold_read(uacce); 406 389 407 390 return sysfs_emit(buf, "%u\n", val); ··· 416 393 struct uacce_device *uacce = to_uacce_device(dev); 417 394 unsigned long val; 418 395 int ret; 396 + 397 + if (!uacce->ops->isolate_err_threshold_write) 398 + return -ENOENT; 419 399 420 400 if (kstrtoul(buf, 0, &val) < 0) 421 401 return -EINVAL; ··· 545 519 */ 546 520 int uacce_register(struct uacce_device *uacce) 547 521 { 522 + int ret; 523 + 548 524 if (!uacce) 549 525 return -ENODEV; 550 526 ··· 557 529 uacce->cdev->ops = &uacce_fops; 558 530 uacce->cdev->owner = THIS_MODULE; 559 531 560 - return cdev_device_add(uacce->cdev, &uacce->dev); 532 + ret = cdev_device_add(uacce->cdev, &uacce->dev); 533 + if (ret) 534 + uacce->cdev = NULL; 535 + 536 + return ret; 561 537 } 562 538 EXPORT_SYMBOL_GPL(uacce_register); 563 539
+4 -4
drivers/mux/mmio.c
··· 101 101 mux_mmio = mux_chip_priv(mux_chip); 102 102 103 103 mux_mmio->fields = devm_kmalloc(dev, num_fields * sizeof(*mux_mmio->fields), GFP_KERNEL); 104 - if (IS_ERR(mux_mmio->fields)) 105 - return PTR_ERR(mux_mmio->fields); 104 + if (!mux_mmio->fields) 105 + return -ENOMEM; 106 106 107 107 mux_mmio->hardware_states = devm_kmalloc(dev, num_fields * 108 108 sizeof(*mux_mmio->hardware_states), GFP_KERNEL); 109 - if (IS_ERR(mux_mmio->hardware_states)) 110 - return PTR_ERR(mux_mmio->hardware_states); 109 + if (!mux_mmio->hardware_states) 110 + return -ENOMEM; 111 111 112 112 for (i = 0; i < num_fields; i++) { 113 113 struct mux_control *mux = &mux_chip->mux[i];
+29 -25
drivers/slimbus/core.c
··· 146 146 { 147 147 struct slim_device *sbdev = to_slim_device(dev); 148 148 149 + of_node_put(sbdev->dev.of_node); 149 150 kfree(sbdev); 150 151 } 151 152 ··· 281 280 /* slim_remove_device: Remove the effect of slim_add_device() */ 282 281 static void slim_remove_device(struct slim_device *sbdev) 283 282 { 284 - of_node_put(sbdev->dev.of_node); 285 283 device_unregister(&sbdev->dev); 286 284 } 287 285 ··· 366 366 * @ctrl: Controller on which this device will be added/queried 367 367 * @e_addr: Enumeration address of the device to be queried 368 368 * 369 + * Takes a reference to the embedded struct device which needs to be dropped 370 + * after use. 371 + * 369 372 * Return: pointer to a device if it has already reported. Creates a new 370 373 * device and returns pointer to it if the device has not yet enumerated. 371 374 */ ··· 382 379 sbdev = slim_alloc_device(ctrl, e_addr, NULL); 383 380 if (!sbdev) 384 381 return ERR_PTR(-ENOMEM); 382 + 383 + get_device(&sbdev->dev); 385 384 } 386 385 387 386 return sbdev; 388 387 } 389 388 EXPORT_SYMBOL_GPL(slim_get_device); 390 389 391 - static struct slim_device *of_find_slim_device(struct slim_controller *ctrl, 392 - struct device_node *np) 390 + /** 391 + * of_slim_get_device() - get handle to a device using dt node. 392 + * 393 + * @ctrl: Controller on which this device will be queried 394 + * @np: node pointer to device 395 + * 396 + * Takes a reference to the embedded struct device which needs to be dropped 397 + * after use. 398 + * 399 + * Return: pointer to a device if it has been registered, otherwise NULL. 400 + */ 401 + struct slim_device *of_slim_get_device(struct slim_controller *ctrl, 402 + struct device_node *np) 393 403 { 394 404 struct slim_device *sbdev; 395 405 struct device *dev; ··· 414 398 } 415 399 416 400 return NULL; 417 - } 418 - 419 - /** 420 - * of_slim_get_device() - get handle to a device using dt node. 421 - * 422 - * @ctrl: Controller on which this device will be added/queried 423 - * @np: node pointer to device 424 - * 425 - * Return: pointer to a device if it has already reported. Creates a new 426 - * device and returns pointer to it if the device has not yet enumerated. 427 - */ 428 - struct slim_device *of_slim_get_device(struct slim_controller *ctrl, 429 - struct device_node *np) 430 - { 431 - return of_find_slim_device(ctrl, np); 432 401 } 433 402 EXPORT_SYMBOL_GPL(of_slim_get_device); 434 403 ··· 490 489 if (ctrl->sched.clk_state != SLIM_CLK_ACTIVE) { 491 490 dev_err(ctrl->dev, "slim ctrl not active,state:%d, ret:%d\n", 492 491 ctrl->sched.clk_state, ret); 493 - goto slimbus_not_active; 492 + goto out_put_rpm; 494 493 } 495 494 496 495 sbdev = slim_get_device(ctrl, e_addr); 497 - if (IS_ERR(sbdev)) 498 - return -ENODEV; 496 + if (IS_ERR(sbdev)) { 497 + ret = -ENODEV; 498 + goto out_put_rpm; 499 + } 499 500 500 501 if (sbdev->is_laddr_valid) { 501 502 *laddr = sbdev->laddr; 502 - return 0; 503 + ret = 0; 504 + } else { 505 + ret = slim_device_alloc_laddr(sbdev, true); 503 506 } 504 507 505 - ret = slim_device_alloc_laddr(sbdev, true); 506 - 507 - slimbus_not_active: 508 + put_device(&sbdev->dev); 509 + out_put_rpm: 508 510 pm_runtime_mark_last_busy(ctrl->dev); 509 511 pm_runtime_put_autosuspend(ctrl->dev); 510 512 return ret;
+2 -2
drivers/uio/uio_pci_generic_sva.c
··· 29 29 struct uio_pci_sva_dev *udev = info->priv; 30 30 struct iommu_domain *domain; 31 31 32 - if (!udev && !udev->pdev) 32 + if (!udev || !udev->pdev) 33 33 return -ENODEV; 34 34 35 35 domain = iommu_get_domain_for_dev(&udev->pdev->dev); ··· 51 51 { 52 52 struct uio_pci_sva_dev *udev = info->priv; 53 53 54 - if (!udev && !udev->pdev) 54 + if (!udev || !udev->pdev) 55 55 return -ENODEV; 56 56 57 57 iommu_sva_unbind_device(udev->sva_handle);
+19 -41
drivers/w1/slaves/w1_therm.c
··· 1836 1836 struct w1_slave *sl = dev_to_w1_slave(device); 1837 1837 struct therm_info info; 1838 1838 u8 new_config_register[3]; /* array of data to be written */ 1839 - int temp, ret; 1840 - char *token = NULL; 1839 + long long temp; 1840 + int ret = 0; 1841 1841 s8 tl, th; /* 1 byte per value + temp ring order */ 1842 - char *p_args, *orig; 1842 + const char *p = buf; 1843 + char *endp; 1843 1844 1844 - p_args = orig = kmalloc(size, GFP_KERNEL); 1845 - /* Safe string copys as buf is const */ 1846 - if (!p_args) { 1847 - dev_warn(device, 1848 - "%s: error unable to allocate memory %d\n", 1849 - __func__, -ENOMEM); 1850 - return size; 1851 - } 1852 - strcpy(p_args, buf); 1853 - 1854 - /* Split string using space char */ 1855 - token = strsep(&p_args, " "); 1856 - 1857 - if (!token) { 1858 - dev_info(device, 1859 - "%s: error parsing args %d\n", __func__, -EINVAL); 1860 - goto free_m; 1861 - } 1862 - 1863 - /* Convert 1st entry to int */ 1864 - ret = kstrtoint (token, 10, &temp); 1845 + temp = simple_strtoll(p, &endp, 10); 1846 + if (p == endp || *endp != ' ') 1847 + ret = -EINVAL; 1848 + else if (temp < INT_MIN || temp > INT_MAX) 1849 + ret = -ERANGE; 1865 1850 if (ret) { 1866 1851 dev_info(device, 1867 1852 "%s: error parsing args %d\n", __func__, ret); 1868 - goto free_m; 1853 + return size; 1869 1854 } 1870 1855 1871 1856 tl = int_to_short(temp); 1872 1857 1873 - /* Split string using space char */ 1874 - token = strsep(&p_args, " "); 1875 - if (!token) { 1876 - dev_info(device, 1877 - "%s: error parsing args %d\n", __func__, -EINVAL); 1878 - goto free_m; 1879 - } 1880 - /* Convert 2nd entry to int */ 1881 - ret = kstrtoint (token, 10, &temp); 1858 + p = endp + 1; 1859 + temp = simple_strtoll(p, &endp, 10); 1860 + if (p == endp) 1861 + ret = -EINVAL; 1862 + else if (temp < INT_MIN || temp > INT_MAX) 1863 + ret = -ERANGE; 1882 1864 if (ret) { 1883 1865 dev_info(device, 1884 1866 "%s: error parsing args %d\n", __func__, ret); 1885 - goto free_m; 1867 + return size; 1886 1868 } 1887 1869 1888 1870 /* Prepare to cast to short by eliminating out of range values */ ··· 1887 1905 dev_info(device, 1888 1906 "%s: error reading from the slave device %d\n", 1889 1907 __func__, ret); 1890 - goto free_m; 1908 + return size; 1891 1909 } 1892 1910 1893 1911 /* Write data in the device RAM */ ··· 1895 1913 dev_info(device, 1896 1914 "%s: Device not supported by the driver %d\n", 1897 1915 __func__, -ENODEV); 1898 - goto free_m; 1916 + return size; 1899 1917 } 1900 1918 1901 1919 ret = SLAVE_SPECIFIC_FUNC(sl)->write_data(sl, new_config_register); ··· 1903 1921 dev_info(device, 1904 1922 "%s: error writing to the slave device %d\n", 1905 1923 __func__, ret); 1906 - 1907 - free_m: 1908 - /* free allocated memory */ 1909 - kfree(orig); 1910 1924 1911 1925 return size; 1912 1926 }
-2
drivers/w1/w1.c
··· 758 758 if (err < 0) { 759 759 dev_err(&dev->dev, "%s: Attaching %s failed.\n", __func__, 760 760 sl->name); 761 - dev->slave_count--; 762 - w1_family_put(sl->family); 763 761 atomic_dec(&sl->master->refcnt); 764 762 kfree(sl); 765 763 return err;
+2
include/linux/iio/iio-opaque.h
··· 14 14 * @mlock: lock used to prevent simultaneous device state changes 15 15 * @mlock_key: lockdep class for iio_dev lock 16 16 * @info_exist_lock: lock to prevent use during removal 17 + * @info_exist_key: lockdep class for info_exist lock 17 18 * @trig_readonly: mark the current trigger immutable 18 19 * @event_interface: event chrdevs associated with interrupt lines 19 20 * @attached_buffers: array of buffers statically attached by the driver ··· 48 47 struct mutex mlock; 49 48 struct lock_class_key mlock_key; 50 49 struct mutex info_exist_lock; 50 + struct lock_class_key info_exist_key; 51 51 bool trig_readonly; 52 52 struct iio_event_interface *event_interface; 53 53 struct iio_buffer **attached_buffers;
+1 -1
include/uapi/linux/comedi.h
··· 640 640 641 641 /** 642 642 * struct comedi_rangeinfo - used to retrieve the range table for a channel 643 - * @range_type: Encodes subdevice index (bits 27:24), channel index 643 + * @range_type: Encodes subdevice index (bits 31:24), channel index 644 644 * (bits 23:16) and range table length (bits 15:0). 645 645 * @range_ptr: Pointer to array of @struct comedi_krange to be filled 646 646 * in with the range table for the channel or subdevice.