Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull char/misc driver fixes from Greg KH:
"Here are some small misc driver fixes for 5.15-rc4. They are in two
"groups":

- ipack driver fixes for issues found by Johan Hovold

- interconnect driver fixes for reported problems

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

* tag 'char-misc-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
ipack: ipoctal: fix module reference leak
ipack: ipoctal: fix missing allocation-failure check
ipack: ipoctal: fix tty-registration error handling
ipack: ipoctal: fix tty registration race
ipack: ipoctal: fix stack information leak
interconnect: qcom: sdm660: Add missing a2noc qos clocks
dt-bindings: interconnect: sdm660: Add missing a2noc qos clocks
interconnect: qcom: sdm660: Correct NOC_QOS_PRIORITY shift and mask
interconnect: qcom: sdm660: Fix id of slv_cnoc_mnoc_cfg

+108 -26
+42 -4
Documentation/devicetree/bindings/interconnect/qcom,sdm660.yaml
··· 31 31 32 32 clocks: 33 33 minItems: 1 34 - maxItems: 3 34 + maxItems: 7 35 35 36 36 clock-names: 37 37 minItems: 1 38 - maxItems: 3 38 + maxItems: 7 39 39 40 40 required: 41 41 - compatible ··· 72 72 contains: 73 73 enum: 74 74 - qcom,sdm660-a2noc 75 + then: 76 + properties: 77 + clocks: 78 + items: 79 + - description: Bus Clock. 80 + - description: Bus A Clock. 81 + - description: IPA Clock. 82 + - description: UFS AXI Clock. 83 + - description: Aggregate2 UFS AXI Clock. 84 + - description: Aggregate2 USB3 AXI Clock. 85 + - description: Config NoC USB2 AXI Clock. 86 + clock-names: 87 + items: 88 + - const: bus 89 + - const: bus_a 90 + - const: ipa 91 + - const: ufs_axi 92 + - const: aggre2_ufs_axi 93 + - const: aggre2_usb3_axi 94 + - const: cfg_noc_usb2_axi 95 + 96 + - if: 97 + properties: 98 + compatible: 99 + contains: 100 + enum: 75 101 - qcom,sdm660-bimc 76 102 - qcom,sdm660-cnoc 77 103 - qcom,sdm660-gnoc ··· 117 91 - | 118 92 #include <dt-bindings/clock/qcom,rpmcc.h> 119 93 #include <dt-bindings/clock/qcom,mmcc-sdm660.h> 94 + #include <dt-bindings/clock/qcom,gcc-sdm660.h> 120 95 121 96 bimc: interconnect@1008000 { 122 97 compatible = "qcom,sdm660-bimc"; ··· 150 123 compatible = "qcom,sdm660-a2noc"; 151 124 reg = <0x01704000 0xc100>; 152 125 #interconnect-cells = <1>; 153 - clock-names = "bus", "bus_a"; 126 + clock-names = "bus", 127 + "bus_a", 128 + "ipa", 129 + "ufs_axi", 130 + "aggre2_ufs_axi", 131 + "aggre2_usb3_axi", 132 + "cfg_noc_usb2_axi"; 154 133 clocks = <&rpmcc RPM_SMD_AGGR2_NOC_CLK>, 155 - <&rpmcc RPM_SMD_AGGR2_NOC_A_CLK>; 134 + <&rpmcc RPM_SMD_AGGR2_NOC_A_CLK>, 135 + <&rpmcc RPM_SMD_IPA_CLK>, 136 + <&gcc GCC_UFS_AXI_CLK>, 137 + <&gcc GCC_AGGRE2_UFS_AXI_CLK>, 138 + <&gcc GCC_AGGRE2_USB3_AXI_CLK>, 139 + <&gcc GCC_CFG_NOC_USB2_AXI_CLK>; 156 140 }; 157 141 158 142 mnoc: interconnect@1745000 {
+19 -6
drivers/interconnect/qcom/sdm660.c
··· 44 44 #define NOC_PERM_MODE_BYPASS (1 << NOC_QOS_MODE_BYPASS) 45 45 46 46 #define NOC_QOS_PRIORITYn_ADDR(n) (0x8 + (n * 0x1000)) 47 - #define NOC_QOS_PRIORITY_MASK 0xf 47 + #define NOC_QOS_PRIORITY_P1_MASK 0xc 48 + #define NOC_QOS_PRIORITY_P0_MASK 0x3 48 49 #define NOC_QOS_PRIORITY_P1_SHIFT 0x2 49 - #define NOC_QOS_PRIORITY_P0_SHIFT 0x3 50 50 51 51 #define NOC_QOS_MODEn_ADDR(n) (0xc + (n * 0x1000)) 52 52 #define NOC_QOS_MODEn_MASK 0x3 ··· 171 171 { .id = "bus" }, 172 172 { .id = "bus_a" }, 173 173 { .id = "iface" }, 174 + }; 175 + 176 + static const struct clk_bulk_data bus_a2noc_clocks[] = { 177 + { .id = "bus" }, 178 + { .id = "bus_a" }, 179 + { .id = "ipa" }, 180 + { .id = "ufs_axi" }, 181 + { .id = "aggre2_ufs_axi" }, 182 + { .id = "aggre2_usb3_axi" }, 183 + { .id = "cfg_noc_usb2_axi" }, 174 184 }; 175 185 176 186 /** ··· 317 307 DEFINE_QNODE(slv_prng, SDM660_SLAVE_PRNG, 4, -1, 44, true, -1, 0, -1, 0); 318 308 DEFINE_QNODE(slv_spdm, SDM660_SLAVE_SPDM, 4, -1, 60, true, -1, 0, -1, 0); 319 309 DEFINE_QNODE(slv_qdss_cfg, SDM660_SLAVE_QDSS_CFG, 4, -1, 63, true, -1, 0, -1, 0); 320 - DEFINE_QNODE(slv_cnoc_mnoc_cfg, SDM660_SLAVE_BLSP_1, 4, -1, 66, true, -1, 0, -1, SDM660_MASTER_CNOC_MNOC_CFG); 310 + DEFINE_QNODE(slv_cnoc_mnoc_cfg, SDM660_SLAVE_CNOC_MNOC_CFG, 4, -1, 66, true, -1, 0, -1, SDM660_MASTER_CNOC_MNOC_CFG); 321 311 DEFINE_QNODE(slv_snoc_cfg, SDM660_SLAVE_SNOC_CFG, 4, -1, 70, true, -1, 0, -1, 0); 322 312 DEFINE_QNODE(slv_qm_cfg, SDM660_SLAVE_QM_CFG, 4, -1, 212, true, -1, 0, -1, 0); 323 313 DEFINE_QNODE(slv_clk_ctl, SDM660_SLAVE_CLK_CTL, 4, -1, 47, true, -1, 0, -1, 0); ··· 634 624 /* Must be updated one at a time, P1 first, P0 last */ 635 625 val = qos->areq_prio << NOC_QOS_PRIORITY_P1_SHIFT; 636 626 rc = regmap_update_bits(rmap, NOC_QOS_PRIORITYn_ADDR(qos->qos_port), 637 - NOC_QOS_PRIORITY_MASK, val); 627 + NOC_QOS_PRIORITY_P1_MASK, val); 638 628 if (rc) 639 629 return rc; 640 630 641 - val = qos->prio_level << NOC_QOS_PRIORITY_P0_SHIFT; 642 631 return regmap_update_bits(rmap, NOC_QOS_PRIORITYn_ADDR(qos->qos_port), 643 - NOC_QOS_PRIORITY_MASK, val); 632 + NOC_QOS_PRIORITY_P0_MASK, qos->prio_level); 644 633 } 645 634 646 635 static int qcom_icc_set_noc_qos(struct icc_node *src, u64 max_bw) ··· 819 810 qp->bus_clks = devm_kmemdup(dev, bus_mm_clocks, 820 811 sizeof(bus_mm_clocks), GFP_KERNEL); 821 812 qp->num_clks = ARRAY_SIZE(bus_mm_clocks); 813 + } else if (of_device_is_compatible(dev->of_node, "qcom,sdm660-a2noc")) { 814 + qp->bus_clks = devm_kmemdup(dev, bus_a2noc_clocks, 815 + sizeof(bus_a2noc_clocks), GFP_KERNEL); 816 + qp->num_clks = ARRAY_SIZE(bus_a2noc_clocks); 822 817 } else { 823 818 if (of_device_is_compatible(dev->of_node, "qcom,sdm660-bimc")) 824 819 qp->is_bimc_node = true;
+47 -16
drivers/ipack/devices/ipoctal.c
··· 33 33 unsigned int pointer_read; 34 34 unsigned int pointer_write; 35 35 struct tty_port tty_port; 36 + bool tty_registered; 36 37 union scc2698_channel __iomem *regs; 37 38 union scc2698_block __iomem *block_regs; 38 39 unsigned int board_id; ··· 82 81 return 0; 83 82 } 84 83 85 - static int ipoctal_open(struct tty_struct *tty, struct file *file) 84 + static int ipoctal_install(struct tty_driver *driver, struct tty_struct *tty) 86 85 { 87 86 struct ipoctal_channel *channel = dev_get_drvdata(tty->dev); 88 87 struct ipoctal *ipoctal = chan_to_ipoctal(channel, tty->index); 89 - int err; 90 - 91 - tty->driver_data = channel; 88 + int res; 92 89 93 90 if (!ipack_get_carrier(ipoctal->dev)) 94 91 return -EBUSY; 95 92 96 - err = tty_port_open(&channel->tty_port, tty, file); 97 - if (err) 98 - ipack_put_carrier(ipoctal->dev); 93 + res = tty_standard_install(driver, tty); 94 + if (res) 95 + goto err_put_carrier; 99 96 100 - return err; 97 + tty->driver_data = channel; 98 + 99 + return 0; 100 + 101 + err_put_carrier: 102 + ipack_put_carrier(ipoctal->dev); 103 + 104 + return res; 105 + } 106 + 107 + static int ipoctal_open(struct tty_struct *tty, struct file *file) 108 + { 109 + struct ipoctal_channel *channel = tty->driver_data; 110 + 111 + return tty_port_open(&channel->tty_port, tty, file); 101 112 } 102 113 103 114 static void ipoctal_reset_stats(struct ipoctal_stats *stats) ··· 277 264 int res; 278 265 int i; 279 266 struct tty_driver *tty; 280 - char name[20]; 281 267 struct ipoctal_channel *channel; 282 268 struct ipack_region *region; 283 269 void __iomem *addr; ··· 367 355 /* Fill struct tty_driver with ipoctal data */ 368 356 tty->owner = THIS_MODULE; 369 357 tty->driver_name = KBUILD_MODNAME; 370 - sprintf(name, KBUILD_MODNAME ".%d.%d.", bus_nr, slot); 371 - tty->name = name; 358 + tty->name = kasprintf(GFP_KERNEL, KBUILD_MODNAME ".%d.%d.", bus_nr, slot); 359 + if (!tty->name) { 360 + res = -ENOMEM; 361 + goto err_put_driver; 362 + } 372 363 tty->major = 0; 373 364 374 365 tty->minor_start = 0; ··· 386 371 res = tty_register_driver(tty); 387 372 if (res) { 388 373 dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n"); 389 - tty_driver_kref_put(tty); 390 - return res; 374 + goto err_free_name; 391 375 } 392 376 393 377 /* Save struct tty_driver for use it when uninstalling the device */ ··· 397 383 398 384 channel = &ipoctal->channel[i]; 399 385 tty_port_init(&channel->tty_port); 400 - tty_port_alloc_xmit_buf(&channel->tty_port); 386 + res = tty_port_alloc_xmit_buf(&channel->tty_port); 387 + if (res) 388 + continue; 401 389 channel->tty_port.ops = &ipoctal_tty_port_ops; 402 390 403 391 ipoctal_reset_stats(&channel->stats); ··· 407 391 spin_lock_init(&channel->lock); 408 392 channel->pointer_read = 0; 409 393 channel->pointer_write = 0; 410 - tty_dev = tty_port_register_device(&channel->tty_port, tty, i, NULL); 394 + tty_dev = tty_port_register_device_attr(&channel->tty_port, tty, 395 + i, NULL, channel, NULL); 411 396 if (IS_ERR(tty_dev)) { 412 397 dev_err(&ipoctal->dev->dev, "Failed to register tty device.\n"); 398 + tty_port_free_xmit_buf(&channel->tty_port); 413 399 tty_port_destroy(&channel->tty_port); 414 400 continue; 415 401 } 416 - dev_set_drvdata(tty_dev, channel); 402 + channel->tty_registered = true; 417 403 } 418 404 419 405 /* ··· 427 409 ipoctal_irq_handler, ipoctal); 428 410 429 411 return 0; 412 + 413 + err_free_name: 414 + kfree(tty->name); 415 + err_put_driver: 416 + tty_driver_kref_put(tty); 417 + 418 + return res; 430 419 } 431 420 432 421 static inline int ipoctal_copy_write_buffer(struct ipoctal_channel *channel, ··· 673 648 674 649 static const struct tty_operations ipoctal_fops = { 675 650 .ioctl = NULL, 651 + .install = ipoctal_install, 676 652 .open = ipoctal_open, 677 653 .close = ipoctal_close, 678 654 .write = ipoctal_write_tty, ··· 716 690 717 691 for (i = 0; i < NR_CHANNELS; i++) { 718 692 struct ipoctal_channel *channel = &ipoctal->channel[i]; 693 + 694 + if (!channel->tty_registered) 695 + continue; 696 + 719 697 tty_unregister_device(ipoctal->tty_drv, i); 720 698 tty_port_free_xmit_buf(&channel->tty_port); 721 699 tty_port_destroy(&channel->tty_port); 722 700 } 723 701 724 702 tty_unregister_driver(ipoctal->tty_drv); 703 + kfree(ipoctal->tty_drv->name); 725 704 tty_driver_kref_put(ipoctal->tty_drv); 726 705 kfree(ipoctal); 727 706 }