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

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

Pull char/misc driver fixes from Greg KH:
"Here is a big set of char/misc/other driver fixes for 5.13-rc3.

The majority here is the fallout of the umn.edu re-review of all prior
submissions. That resulted in a bunch of reverts along with the
"correct" changes made, such that there is no regression of any of the
potential fixes that were made by those individuals. I would like to
thank the over 80 different developers who helped with the review and
fixes for this mess.

Other than that, there's a few habanna driver fixes for reported
issues, and some dyndbg fixes for reported problems.

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

* tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (82 commits)
misc: eeprom: at24: check suspend status before disable regulator
uio_hv_generic: Fix another memory leak in error handling paths
uio_hv_generic: Fix a memory leak in error handling paths
uio/uio_pci_generic: fix return value changed in refactoring
Revert "Revert "ALSA: usx2y: Fix potential NULL pointer dereference""
dyndbg: drop uninformative vpr_info
dyndbg: avoid calling dyndbg_emit_prefix when it has no work
binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION
cdrom: gdrom: initialize global variable at init time
brcmfmac: properly check for bus register errors
Revert "brcmfmac: add a check for the status of usb_register"
video: imsttfb: check for ioremap() failures
Revert "video: imsttfb: fix potential NULL pointer dereferences"
net: liquidio: Add missing null pointer checks
Revert "net: liquidio: fix a NULL pointer dereference"
media: gspca: properly check for errors in po1030_probe()
Revert "media: gspca: Check the return value of write_bridge for timeout"
media: gspca: mt9m111: Check write_bridge for timeout
Revert "media: gspca: mt9m111: Check write_bridge for timeout"
media: dvb: Add check on sp8870_readreg return
...

+503 -421
+1 -1
drivers/android/binder.c
··· 4918 4918 uint32_t enable; 4919 4919 4920 4920 if (copy_from_user(&enable, ubuf, sizeof(enable))) { 4921 - ret = -EINVAL; 4921 + ret = -EFAULT; 4922 4922 goto err; 4923 4923 } 4924 4924 binder_inner_proc_lock(proc);
+10 -3
drivers/cdrom/gdrom.c
··· 744 744 static int probe_gdrom(struct platform_device *devptr) 745 745 { 746 746 int err; 747 + 748 + /* 749 + * Ensure our "one" device is initialized properly in case of previous 750 + * usages of it 751 + */ 752 + memset(&gd, 0, sizeof(gd)); 753 + 747 754 /* Start the device */ 748 755 if (gdrom_execute_diagnostic() != 1) { 749 756 pr_warn("ATA Probe for GDROM failed\n"); ··· 837 830 if (gdrom_major) 838 831 unregister_blkdev(gdrom_major, GDROM_DEV_NAME); 839 832 unregister_cdrom(gd.cd_info); 833 + kfree(gd.cd_info); 834 + kfree(gd.toc); 840 835 841 836 return 0; 842 837 } ··· 854 845 static int __init init_gdrom(void) 855 846 { 856 847 int rc; 857 - gd.toc = NULL; 848 + 858 849 rc = platform_driver_register(&gdrom_driver); 859 850 if (rc) 860 851 return rc; ··· 870 861 { 871 862 platform_device_unregister(pd); 872 863 platform_driver_unregister(&gdrom_driver); 873 - kfree(gd.toc); 874 - kfree(gd.cd_info); 875 864 } 876 865 877 866 module_init(init_gdrom);
+2
drivers/char/hpet.c
··· 984 984 hdp->hd_phys_address = fixmem32->address; 985 985 hdp->hd_address = ioremap(fixmem32->address, 986 986 HPET_RANGE_SIZE); 987 + if (!hdp->hd_address) 988 + return AE_ERROR; 987 989 988 990 if (hpet_is_known(hdp)) { 989 991 iounmap(hdp->hd_address);
-1
drivers/crypto/cavium/nitrox/nitrox_main.c
··· 442 442 err = pci_request_mem_regions(pdev, nitrox_driver_name); 443 443 if (err) { 444 444 pci_disable_device(pdev); 445 - dev_err(&pdev->dev, "Failed to request mem regions!\n"); 446 445 return err; 447 446 } 448 447 pci_set_master(pdev);
+16 -1
drivers/dma/qcom/hidma_mgmt.c
··· 418 418 hidma_mgmt_of_populate_channels(child); 419 419 } 420 420 #endif 421 - return platform_driver_register(&hidma_mgmt_driver); 421 + /* 422 + * We do not check for return value here, as it is assumed that 423 + * platform_driver_register must not fail. The reason for this is that 424 + * the (potential) hidma_mgmt_of_populate_channels calls above are not 425 + * cleaned up if it does fail, and to do this work is quite 426 + * complicated. In particular, various calls of of_address_to_resource, 427 + * of_irq_to_resource, platform_device_register_full, of_dma_configure, 428 + * and of_msi_configure which then call other functions and so on, must 429 + * be cleaned up - this is not a trivial exercise. 430 + * 431 + * Currently, this module is not intended to be unloaded, and there is 432 + * no module_exit function defined which does the needed cleanup. For 433 + * this reason, we have to assume success here. 434 + */ 435 + platform_driver_register(&hidma_mgmt_driver); 422 436 437 + return 0; 423 438 } 424 439 module_init(hidma_mgmt_init); 425 440 MODULE_LICENSE("GPL v2");
+2 -9
drivers/hwmon/lm80.c
··· 596 596 struct device *dev = &client->dev; 597 597 struct device *hwmon_dev; 598 598 struct lm80_data *data; 599 - int rv; 600 599 601 600 data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL); 602 601 if (!data) ··· 608 609 lm80_init_client(client); 609 610 610 611 /* A few vars need to be filled upon startup */ 611 - rv = lm80_read_value(client, LM80_REG_FAN_MIN(1)); 612 - if (rv < 0) 613 - return rv; 614 - data->fan[f_min][0] = rv; 615 - rv = lm80_read_value(client, LM80_REG_FAN_MIN(2)); 616 - if (rv < 0) 617 - return rv; 618 - data->fan[f_min][1] = rv; 612 + data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1)); 613 + data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2)); 619 614 620 615 hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, 621 616 data, lm80_groups);
+8 -9
drivers/isdn/hardware/mISDN/hfcsusb.c
··· 46 46 static void hfcsusb_stop_endpoint(struct hfcsusb *hw, int channel); 47 47 static int hfcsusb_setup_bch(struct bchannel *bch, int protocol); 48 48 static void deactivate_bchannel(struct bchannel *bch); 49 - static void hfcsusb_ph_info(struct hfcsusb *hw); 49 + static int hfcsusb_ph_info(struct hfcsusb *hw); 50 50 51 51 /* start next background transfer for control channel */ 52 52 static void ··· 241 241 * send full D/B channel status information 242 242 * as MPH_INFORMATION_IND 243 243 */ 244 - static void 244 + static int 245 245 hfcsusb_ph_info(struct hfcsusb *hw) 246 246 { 247 247 struct ph_info *phi; ··· 250 250 251 251 phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC); 252 252 if (!phi) 253 - return; 253 + return -ENOMEM; 254 254 255 255 phi->dch.ch.protocol = hw->protocol; 256 256 phi->dch.ch.Flags = dch->Flags; ··· 263 263 _queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY, 264 264 struct_size(phi, bch, dch->dev.nrbchan), phi, GFP_ATOMIC); 265 265 kfree(phi); 266 + 267 + return 0; 266 268 } 267 269 268 270 /* ··· 349 347 ret = l1_event(dch->l1, hh->prim); 350 348 break; 351 349 case MPH_INFORMATION_REQ: 352 - hfcsusb_ph_info(hw); 353 - ret = 0; 350 + ret = hfcsusb_ph_info(hw); 354 351 break; 355 352 } 356 353 ··· 404 403 hw->name, __func__, cmd); 405 404 return -1; 406 405 } 407 - hfcsusb_ph_info(hw); 408 - return 0; 406 + return hfcsusb_ph_info(hw); 409 407 } 410 408 411 409 static int ··· 746 746 handle_led(hw, (bch->nr == 1) ? LED_B1_OFF : 747 747 LED_B2_OFF); 748 748 } 749 - hfcsusb_ph_info(hw); 750 - return 0; 749 + return hfcsusb_ph_info(hw); 751 750 } 752 751 753 752 static void
+13 -8
drivers/isdn/hardware/mISDN/mISDNinfineon.c
··· 630 630 release_io(struct inf_hw *hw) 631 631 { 632 632 if (hw->cfg.mode) { 633 - if (hw->cfg.p) { 633 + if (hw->cfg.mode == AM_MEMIO) { 634 634 release_mem_region(hw->cfg.start, hw->cfg.size); 635 - iounmap(hw->cfg.p); 635 + if (hw->cfg.p) 636 + iounmap(hw->cfg.p); 636 637 } else 637 638 release_region(hw->cfg.start, hw->cfg.size); 638 639 hw->cfg.mode = AM_NONE; 639 640 } 640 641 if (hw->addr.mode) { 641 - if (hw->addr.p) { 642 + if (hw->addr.mode == AM_MEMIO) { 642 643 release_mem_region(hw->addr.start, hw->addr.size); 643 - iounmap(hw->addr.p); 644 + if (hw->addr.p) 645 + iounmap(hw->addr.p); 644 646 } else 645 647 release_region(hw->addr.start, hw->addr.size); 646 648 hw->addr.mode = AM_NONE; ··· 672 670 (ulong)hw->cfg.start, (ulong)hw->cfg.size); 673 671 return err; 674 672 } 675 - if (hw->ci->cfg_mode == AM_MEMIO) 676 - hw->cfg.p = ioremap(hw->cfg.start, hw->cfg.size); 677 673 hw->cfg.mode = hw->ci->cfg_mode; 674 + if (hw->ci->cfg_mode == AM_MEMIO) { 675 + hw->cfg.p = ioremap(hw->cfg.start, hw->cfg.size); 676 + if (!hw->cfg.p) 677 + return -ENOMEM; 678 + } 678 679 if (debug & DEBUG_HW) 679 680 pr_notice("%s: IO cfg %lx (%lu bytes) mode%d\n", 680 681 hw->name, (ulong)hw->cfg.start, ··· 702 697 (ulong)hw->addr.start, (ulong)hw->addr.size); 703 698 return err; 704 699 } 700 + hw->addr.mode = hw->ci->addr_mode; 705 701 if (hw->ci->addr_mode == AM_MEMIO) { 706 702 hw->addr.p = ioremap(hw->addr.start, hw->addr.size); 707 - if (unlikely(!hw->addr.p)) 703 + if (!hw->addr.p) 708 704 return -ENOMEM; 709 705 } 710 - hw->addr.mode = hw->ci->addr_mode; 711 706 if (debug & DEBUG_HW) 712 707 pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n", 713 708 hw->name, (ulong)hw->addr.start,
+1 -1
drivers/leds/leds-lp5523.c
··· 307 307 usleep_range(3000, 6000); 308 308 ret = lp55xx_read(chip, LP5523_REG_STATUS, &status); 309 309 if (ret) 310 - return ret; 310 + goto out; 311 311 status &= LP5523_ENG_STATUS_MASK; 312 312 313 313 if (status != LP5523_ENG_STATUS_MASK) {
+1 -1
drivers/media/dvb-frontends/sp8870.c
··· 281 281 282 282 // read status reg in order to clear pending irqs 283 283 err = sp8870_readreg(state, 0x200); 284 - if (err) 284 + if (err < 0) 285 285 return err; 286 286 287 287 // system controller start
-1
drivers/media/platform/rcar_drif.c
··· 915 915 { 916 916 struct rcar_drif_sdr *sdr = video_drvdata(file); 917 917 918 - memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved)); 919 918 f->fmt.sdr.pixelformat = sdr->fmt->pixelformat; 920 919 f->fmt.sdr.buffersize = sdr->fmt->buffersize; 921 920
+1 -5
drivers/media/usb/gspca/cpia1.c
··· 1424 1424 { 1425 1425 struct sd *sd = (struct sd *) gspca_dev; 1426 1426 struct cam *cam; 1427 - int ret; 1428 1427 1429 1428 sd->mainsFreq = FREQ_DEF == V4L2_CID_POWER_LINE_FREQUENCY_60HZ; 1430 1429 reset_camera_params(gspca_dev); ··· 1435 1436 cam->cam_mode = mode; 1436 1437 cam->nmodes = ARRAY_SIZE(mode); 1437 1438 1438 - ret = goto_low_power(gspca_dev); 1439 - if (ret) 1440 - gspca_err(gspca_dev, "Cannot go to low power mode: %d\n", 1441 - ret); 1439 + goto_low_power(gspca_dev); 1442 1440 /* Check the firmware version. */ 1443 1441 sd->params.version.firmwareVersion = 0; 1444 1442 get_version_information(gspca_dev);
+8 -8
drivers/media/usb/gspca/m5602/m5602_mt9m111.c
··· 195 195 int mt9m111_probe(struct sd *sd) 196 196 { 197 197 u8 data[2] = {0x00, 0x00}; 198 - int i, rc = 0; 198 + int i, err; 199 199 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; 200 200 201 201 if (force_sensor) { ··· 213 213 /* Do the preinit */ 214 214 for (i = 0; i < ARRAY_SIZE(preinit_mt9m111); i++) { 215 215 if (preinit_mt9m111[i][0] == BRIDGE) { 216 - rc |= m5602_write_bridge(sd, 217 - preinit_mt9m111[i][1], 218 - preinit_mt9m111[i][2]); 216 + err = m5602_write_bridge(sd, 217 + preinit_mt9m111[i][1], 218 + preinit_mt9m111[i][2]); 219 219 } else { 220 220 data[0] = preinit_mt9m111[i][2]; 221 221 data[1] = preinit_mt9m111[i][3]; 222 - rc |= m5602_write_sensor(sd, 223 - preinit_mt9m111[i][1], data, 2); 222 + err = m5602_write_sensor(sd, 223 + preinit_mt9m111[i][1], data, 2); 224 224 } 225 + if (err < 0) 226 + return err; 225 227 } 226 - if (rc < 0) 227 - return rc; 228 228 229 229 if (m5602_read_sensor(sd, MT9M111_SC_CHIPVER, data, 2)) 230 230 return -ENODEV;
+7 -7
drivers/media/usb/gspca/m5602/m5602_po1030.c
··· 154 154 155 155 int po1030_probe(struct sd *sd) 156 156 { 157 - int rc = 0; 158 157 u8 dev_id_h = 0, i; 158 + int err; 159 159 struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; 160 160 161 161 if (force_sensor) { ··· 174 174 for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) { 175 175 u8 data = preinit_po1030[i][2]; 176 176 if (preinit_po1030[i][0] == SENSOR) 177 - rc |= m5602_write_sensor(sd, 178 - preinit_po1030[i][1], &data, 1); 177 + err = m5602_write_sensor(sd, preinit_po1030[i][1], 178 + &data, 1); 179 179 else 180 - rc |= m5602_write_bridge(sd, preinit_po1030[i][1], 181 - data); 180 + err = m5602_write_bridge(sd, preinit_po1030[i][1], 181 + data); 182 + if (err < 0) 183 + return err; 182 184 } 183 - if (rc < 0) 184 - return rc; 185 185 186 186 if (m5602_read_sensor(sd, PO1030_DEVID_H, &dev_id_h, 1)) 187 187 return -ENODEV;
+4 -2
drivers/misc/eeprom/at24.c
··· 763 763 at24->nvmem = devm_nvmem_register(dev, &nvmem_config); 764 764 if (IS_ERR(at24->nvmem)) { 765 765 pm_runtime_disable(dev); 766 - regulator_disable(at24->vcc_reg); 766 + if (!pm_runtime_status_suspended(dev)) 767 + regulator_disable(at24->vcc_reg); 767 768 return PTR_ERR(at24->nvmem); 768 769 } 769 770 ··· 775 774 err = at24_read(at24, 0, &test_byte, 1); 776 775 if (err) { 777 776 pm_runtime_disable(dev); 778 - regulator_disable(at24->vcc_reg); 777 + if (!pm_runtime_status_suspended(dev)) 778 + regulator_disable(at24->vcc_reg); 779 779 return -ENODEV; 780 780 } 781 781
+1 -1
drivers/misc/habanalabs/common/command_submission.c
··· 2017 2017 if (completion_value >= target_value) { 2018 2018 *status = CS_WAIT_STATUS_COMPLETED; 2019 2019 } else { 2020 - timeout -= jiffies_to_usecs(completion_rc); 2020 + timeout = completion_rc; 2021 2021 goto wait_again; 2022 2022 } 2023 2023 } else {
+35 -26
drivers/misc/habanalabs/common/firmware_if.c
··· 362 362 } 363 363 364 364 if (err_val & CPU_BOOT_ERR0_SECURITY_NOT_RDY) { 365 - dev_warn(hdev->dev, 365 + dev_err(hdev->dev, 366 366 "Device boot warning - security not ready\n"); 367 - /* This is a warning so we don't want it to disable the 368 - * device 369 - */ 370 - err_val &= ~CPU_BOOT_ERR0_SECURITY_NOT_RDY; 367 + err_exists = true; 371 368 } 372 369 373 370 if (err_val & CPU_BOOT_ERR0_SECURITY_FAIL) { ··· 400 403 err_exists = true; 401 404 } 402 405 403 - if (err_exists) 406 + if (err_exists && ((err_val & ~CPU_BOOT_ERR0_ENABLED) & 407 + lower_32_bits(hdev->boot_error_status_mask))) 404 408 return -EIO; 405 409 406 410 return 0; ··· 659 661 return rc; 660 662 } 661 663 662 - int get_used_pll_index(struct hl_device *hdev, enum pll_index input_pll_index, 664 + int get_used_pll_index(struct hl_device *hdev, u32 input_pll_index, 663 665 enum pll_index *pll_index) 664 666 { 665 667 struct asic_fixed_properties *prop = &hdev->asic_prop; 666 668 u8 pll_byte, pll_bit_off; 667 669 bool dynamic_pll; 668 - 669 - if (input_pll_index >= PLL_MAX) { 670 - dev_err(hdev->dev, "PLL index %d is out of range\n", 671 - input_pll_index); 672 - return -EINVAL; 673 - } 670 + int fw_pll_idx; 674 671 675 672 dynamic_pll = prop->fw_security_status_valid && 676 673 (prop->fw_app_security_map & CPU_BOOT_DEV_STS0_DYN_PLL_EN); ··· 673 680 if (!dynamic_pll) { 674 681 /* 675 682 * in case we are working with legacy FW (each asic has unique 676 - * PLL numbering) extract the legacy numbering 683 + * PLL numbering) use the driver based index as they are 684 + * aligned with fw legacy numbering 677 685 */ 678 - *pll_index = hdev->legacy_pll_map[input_pll_index]; 686 + *pll_index = input_pll_index; 679 687 return 0; 680 688 } 681 689 682 - /* PLL map is a u8 array */ 683 - pll_byte = prop->cpucp_info.pll_map[input_pll_index >> 3]; 684 - pll_bit_off = input_pll_index & 0x7; 685 - 686 - if (!(pll_byte & BIT(pll_bit_off))) { 687 - dev_err(hdev->dev, "PLL index %d is not supported\n", 688 - input_pll_index); 690 + /* retrieve a FW compatible PLL index based on 691 + * ASIC specific user request 692 + */ 693 + fw_pll_idx = hdev->asic_funcs->map_pll_idx_to_fw_idx(input_pll_index); 694 + if (fw_pll_idx < 0) { 695 + dev_err(hdev->dev, "Invalid PLL index (%u) error %d\n", 696 + input_pll_index, fw_pll_idx); 689 697 return -EINVAL; 690 698 } 691 699 692 - *pll_index = input_pll_index; 700 + /* PLL map is a u8 array */ 701 + pll_byte = prop->cpucp_info.pll_map[fw_pll_idx >> 3]; 702 + pll_bit_off = fw_pll_idx & 0x7; 703 + 704 + if (!(pll_byte & BIT(pll_bit_off))) { 705 + dev_err(hdev->dev, "PLL index %d is not supported\n", 706 + fw_pll_idx); 707 + return -EINVAL; 708 + } 709 + 710 + *pll_index = fw_pll_idx; 693 711 694 712 return 0; 695 713 } 696 714 697 - int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, enum pll_index pll_index, 715 + int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, u32 pll_index, 698 716 u16 *pll_freq_arr) 699 717 { 700 718 struct cpucp_packet pkt; ··· 848 844 if (rc) { 849 845 dev_err(hdev->dev, "Failed to read preboot version\n"); 850 846 detect_cpu_boot_status(hdev, status); 851 - fw_read_errors(hdev, boot_err0_reg, 852 - cpu_security_boot_status_reg); 847 + 848 + /* If we read all FF, then something is totally wrong, no point 849 + * of reading specific errors 850 + */ 851 + if (status != -1) 852 + fw_read_errors(hdev, boot_err0_reg, 853 + cpu_security_boot_status_reg); 853 854 return -EIO; 854 855 } 855 856
+15 -8
drivers/misc/habanalabs/common/habanalabs.h
··· 930 930 * driver is ready to receive asynchronous events. This 931 931 * function should be called during the first init and 932 932 * after every hard-reset of the device 933 + * @get_msi_info: Retrieve asic-specific MSI ID of the f/w async event 934 + * @map_pll_idx_to_fw_idx: convert driver specific per asic PLL index to 935 + * generic f/w compatible PLL Indexes 933 936 */ 934 937 struct hl_asic_funcs { 935 938 int (*early_init)(struct hl_device *hdev); ··· 1057 1054 u32 block_id, u32 block_size); 1058 1055 void (*enable_events_from_fw)(struct hl_device *hdev); 1059 1056 void (*get_msi_info)(u32 *table); 1057 + int (*map_pll_idx_to_fw_idx)(u32 pll_idx); 1060 1058 }; 1061 1059 1062 1060 ··· 1954 1950 * @aggregated_cs_counters: aggregated cs counters among all contexts 1955 1951 * @mmu_priv: device-specific MMU data. 1956 1952 * @mmu_func: device-related MMU functions. 1957 - * @legacy_pll_map: map holding map between dynamic (common) PLL indexes and 1958 - * static (asic specific) PLL indexes. 1959 1953 * @dram_used_mem: current DRAM memory consumption. 1960 1954 * @timeout_jiffies: device CS timeout value. 1961 1955 * @max_power: the max power of the device, as configured by the sysadmin. This ··· 1962 1960 * @clock_gating_mask: is clock gating enabled. bitmask that represents the 1963 1961 * different engines. See debugfs-driver-habanalabs for 1964 1962 * details. 1963 + * @boot_error_status_mask: contains a mask of the device boot error status. 1964 + * Each bit represents a different error, according to 1965 + * the defines in hl_boot_if.h. If the bit is cleared, 1966 + * the error will be ignored by the driver during 1967 + * device initialization. Mainly used to debug and 1968 + * workaround firmware bugs 1965 1969 * @in_reset: is device in reset flow. 1966 1970 * @curr_pll_profile: current PLL profile. 1967 1971 * @card_type: Various ASICs have several card types. This indicates the card ··· 2079 2071 struct hl_mmu_priv mmu_priv; 2080 2072 struct hl_mmu_funcs mmu_func[MMU_NUM_PGT_LOCATIONS]; 2081 2073 2082 - enum pll_index *legacy_pll_map; 2083 - 2084 2074 atomic64_t dram_used_mem; 2085 2075 u64 timeout_jiffies; 2086 2076 u64 max_power; 2087 2077 u64 clock_gating_mask; 2078 + u64 boot_error_status_mask; 2088 2079 atomic_t in_reset; 2089 2080 enum hl_pll_frequency curr_pll_profile; 2090 2081 enum cpucp_card_types card_type; ··· 2394 2387 struct hl_info_pci_counters *counters); 2395 2388 int hl_fw_cpucp_total_energy_get(struct hl_device *hdev, 2396 2389 u64 *total_energy); 2397 - int get_used_pll_index(struct hl_device *hdev, enum pll_index input_pll_index, 2390 + int get_used_pll_index(struct hl_device *hdev, u32 input_pll_index, 2398 2391 enum pll_index *pll_index); 2399 - int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, enum pll_index pll_index, 2392 + int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, u32 pll_index, 2400 2393 u16 *pll_freq_arr); 2401 2394 int hl_fw_cpucp_power_get(struct hl_device *hdev, u64 *power); 2402 2395 int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg, ··· 2418 2411 int hl_pci_init(struct hl_device *hdev); 2419 2412 void hl_pci_fini(struct hl_device *hdev); 2420 2413 2421 - long hl_get_frequency(struct hl_device *hdev, enum pll_index pll_index, 2414 + long hl_get_frequency(struct hl_device *hdev, u32 pll_index, 2422 2415 bool curr); 2423 - void hl_set_frequency(struct hl_device *hdev, enum pll_index pll_index, 2416 + void hl_set_frequency(struct hl_device *hdev, u32 pll_index, 2424 2417 u64 freq); 2425 2418 int hl_get_temperature(struct hl_device *hdev, 2426 2419 int sensor_index, u32 attr, long *value);
+7
drivers/misc/habanalabs/common/habanalabs_drv.c
··· 30 30 static int timeout_locked = 30; 31 31 static int reset_on_lockup = 1; 32 32 static int memory_scrub = 1; 33 + static ulong boot_error_status_mask = ULONG_MAX; 33 34 34 35 module_param(timeout_locked, int, 0444); 35 36 MODULE_PARM_DESC(timeout_locked, ··· 43 42 module_param(memory_scrub, int, 0444); 44 43 MODULE_PARM_DESC(memory_scrub, 45 44 "Scrub device memory in various states (0 = no, 1 = yes, default yes)"); 45 + 46 + module_param(boot_error_status_mask, ulong, 0444); 47 + MODULE_PARM_DESC(boot_error_status_mask, 48 + "Mask of the error status during device CPU boot (If bitX is cleared then error X is masked. Default all 1's)"); 46 49 47 50 #define PCI_VENDOR_ID_HABANALABS 0x1da3 48 51 ··· 324 319 hdev->major = hl_major; 325 320 hdev->reset_on_lockup = reset_on_lockup; 326 321 hdev->memory_scrub = memory_scrub; 322 + hdev->boot_error_status_mask = boot_error_status_mask; 323 + 327 324 hdev->pldm = 0; 328 325 329 326 set_driver_behavior_per_device(hdev);
+2 -2
drivers/misc/habanalabs/common/sysfs.c
··· 9 9 10 10 #include <linux/pci.h> 11 11 12 - long hl_get_frequency(struct hl_device *hdev, enum pll_index pll_index, 12 + long hl_get_frequency(struct hl_device *hdev, u32 pll_index, 13 13 bool curr) 14 14 { 15 15 struct cpucp_packet pkt; ··· 44 44 return (long) result; 45 45 } 46 46 47 - void hl_set_frequency(struct hl_device *hdev, enum pll_index pll_index, 47 + void hl_set_frequency(struct hl_device *hdev, u32 pll_index, 48 48 u64 freq) 49 49 { 50 50 struct cpucp_packet pkt;
+23 -36
drivers/misc/habanalabs/gaudi/gaudi.c
··· 105 105 106 106 #define GAUDI_PLL_MAX 10 107 107 108 - /* 109 - * this enum kept here for compatibility with old FW (in which each asic has 110 - * unique PLL numbering 111 - */ 112 - enum gaudi_pll_index { 113 - GAUDI_CPU_PLL = 0, 114 - GAUDI_PCI_PLL, 115 - GAUDI_SRAM_PLL, 116 - GAUDI_HBM_PLL, 117 - GAUDI_NIC_PLL, 118 - GAUDI_DMA_PLL, 119 - GAUDI_MESH_PLL, 120 - GAUDI_MME_PLL, 121 - GAUDI_TPC_PLL, 122 - GAUDI_IF_PLL, 123 - }; 124 - 125 - static enum pll_index gaudi_pll_map[PLL_MAX] = { 126 - [CPU_PLL] = GAUDI_CPU_PLL, 127 - [PCI_PLL] = GAUDI_PCI_PLL, 128 - [SRAM_PLL] = GAUDI_SRAM_PLL, 129 - [HBM_PLL] = GAUDI_HBM_PLL, 130 - [NIC_PLL] = GAUDI_NIC_PLL, 131 - [DMA_PLL] = GAUDI_DMA_PLL, 132 - [MESH_PLL] = GAUDI_MESH_PLL, 133 - [MME_PLL] = GAUDI_MME_PLL, 134 - [TPC_PLL] = GAUDI_TPC_PLL, 135 - [IF_PLL] = GAUDI_IF_PLL, 136 - }; 137 - 138 108 static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = { 139 109 "gaudi cq 0_0", "gaudi cq 0_1", "gaudi cq 0_2", "gaudi cq 0_3", 140 110 "gaudi cq 1_0", "gaudi cq 1_1", "gaudi cq 1_2", "gaudi cq 1_3", ··· 780 810 freq = 0; 781 811 } 782 812 } else { 783 - rc = hl_fw_cpucp_pll_info_get(hdev, CPU_PLL, pll_freq_arr); 813 + rc = hl_fw_cpucp_pll_info_get(hdev, HL_GAUDI_CPU_PLL, pll_freq_arr); 784 814 785 815 if (rc) 786 816 return rc; ··· 1621 1651 gaudi->max_freq_value = GAUDI_MAX_CLK_FREQ; 1622 1652 1623 1653 hdev->asic_specific = gaudi; 1624 - 1625 - /* store legacy PLL map */ 1626 - hdev->legacy_pll_map = gaudi_pll_map; 1627 1654 1628 1655 /* Create DMA pool for small allocations */ 1629 1656 hdev->dma_pool = dma_pool_create(dev_name(hdev->dev), ··· 5579 5612 struct hl_cs_job *job; 5580 5613 u32 cb_size, ctl, err_cause; 5581 5614 struct hl_cb *cb; 5615 + u64 id; 5582 5616 int rc; 5583 5617 5584 5618 cb = hl_cb_kernel_create(hdev, PAGE_SIZE, false); ··· 5646 5678 } 5647 5679 5648 5680 release_cb: 5681 + id = cb->id; 5649 5682 hl_cb_put(cb); 5650 - hl_cb_destroy(hdev, &hdev->kernel_cb_mgr, cb->id << PAGE_SHIFT); 5683 + hl_cb_destroy(hdev, &hdev->kernel_cb_mgr, id << PAGE_SHIFT); 5651 5684 5652 5685 return rc; 5653 5686 } ··· 8752 8783 WREG32(mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR, GAUDI_EVENT_INTS_REGISTER); 8753 8784 } 8754 8785 8786 + static int gaudi_map_pll_idx_to_fw_idx(u32 pll_idx) 8787 + { 8788 + switch (pll_idx) { 8789 + case HL_GAUDI_CPU_PLL: return CPU_PLL; 8790 + case HL_GAUDI_PCI_PLL: return PCI_PLL; 8791 + case HL_GAUDI_NIC_PLL: return NIC_PLL; 8792 + case HL_GAUDI_DMA_PLL: return DMA_PLL; 8793 + case HL_GAUDI_MESH_PLL: return MESH_PLL; 8794 + case HL_GAUDI_MME_PLL: return MME_PLL; 8795 + case HL_GAUDI_TPC_PLL: return TPC_PLL; 8796 + case HL_GAUDI_IF_PLL: return IF_PLL; 8797 + case HL_GAUDI_SRAM_PLL: return SRAM_PLL; 8798 + case HL_GAUDI_HBM_PLL: return HBM_PLL; 8799 + default: return -EINVAL; 8800 + } 8801 + } 8802 + 8755 8803 static const struct hl_asic_funcs gaudi_funcs = { 8756 8804 .early_init = gaudi_early_init, 8757 8805 .early_fini = gaudi_early_fini, ··· 8852 8866 .ack_protection_bits_errors = gaudi_ack_protection_bits_errors, 8853 8867 .get_hw_block_id = gaudi_get_hw_block_id, 8854 8868 .hw_block_mmap = gaudi_block_mmap, 8855 - .enable_events_from_fw = gaudi_enable_events_from_fw 8869 + .enable_events_from_fw = gaudi_enable_events_from_fw, 8870 + .map_pll_idx_to_fw_idx = gaudi_map_pll_idx_to_fw_idx 8856 8871 }; 8857 8872 8858 8873 /**
+6 -6
drivers/misc/habanalabs/gaudi/gaudi_hwmgr.c
··· 13 13 struct gaudi_device *gaudi = hdev->asic_specific; 14 14 15 15 if (freq == PLL_LAST) 16 - hl_set_frequency(hdev, MME_PLL, gaudi->max_freq_value); 16 + hl_set_frequency(hdev, HL_GAUDI_MME_PLL, gaudi->max_freq_value); 17 17 } 18 18 19 19 int gaudi_get_clk_rate(struct hl_device *hdev, u32 *cur_clk, u32 *max_clk) ··· 23 23 if (!hl_device_operational(hdev, NULL)) 24 24 return -ENODEV; 25 25 26 - value = hl_get_frequency(hdev, MME_PLL, false); 26 + value = hl_get_frequency(hdev, HL_GAUDI_MME_PLL, false); 27 27 28 28 if (value < 0) { 29 29 dev_err(hdev->dev, "Failed to retrieve device max clock %ld\n", ··· 33 33 34 34 *max_clk = (value / 1000 / 1000); 35 35 36 - value = hl_get_frequency(hdev, MME_PLL, true); 36 + value = hl_get_frequency(hdev, HL_GAUDI_MME_PLL, true); 37 37 38 38 if (value < 0) { 39 39 dev_err(hdev->dev, ··· 57 57 if (!hl_device_operational(hdev, NULL)) 58 58 return -ENODEV; 59 59 60 - value = hl_get_frequency(hdev, MME_PLL, false); 60 + value = hl_get_frequency(hdev, HL_GAUDI_MME_PLL, false); 61 61 62 62 gaudi->max_freq_value = value; 63 63 ··· 85 85 86 86 gaudi->max_freq_value = value * 1000 * 1000; 87 87 88 - hl_set_frequency(hdev, MME_PLL, gaudi->max_freq_value); 88 + hl_set_frequency(hdev, HL_GAUDI_MME_PLL, gaudi->max_freq_value); 89 89 90 90 fail: 91 91 return count; ··· 100 100 if (!hl_device_operational(hdev, NULL)) 101 101 return -ENODEV; 102 102 103 - value = hl_get_frequency(hdev, MME_PLL, true); 103 + value = hl_get_frequency(hdev, HL_GAUDI_MME_PLL, true); 104 104 105 105 return sprintf(buf, "%lu\n", (value / 1000 / 1000)); 106 106 }
+18 -29
drivers/misc/habanalabs/goya/goya.c
··· 118 118 #define IS_MME_IDLE(mme_arch_sts) \ 119 119 (((mme_arch_sts) & MME_ARCH_IDLE_MASK) == MME_ARCH_IDLE_MASK) 120 120 121 - /* 122 - * this enum kept here for compatibility with old FW (in which each asic has 123 - * unique PLL numbering 124 - */ 125 - enum goya_pll_index { 126 - GOYA_CPU_PLL = 0, 127 - GOYA_IC_PLL, 128 - GOYA_MC_PLL, 129 - GOYA_MME_PLL, 130 - GOYA_PCI_PLL, 131 - GOYA_EMMC_PLL, 132 - GOYA_TPC_PLL, 133 - }; 134 - 135 - static enum pll_index goya_pll_map[PLL_MAX] = { 136 - [CPU_PLL] = GOYA_CPU_PLL, 137 - [IC_PLL] = GOYA_IC_PLL, 138 - [MC_PLL] = GOYA_MC_PLL, 139 - [MME_PLL] = GOYA_MME_PLL, 140 - [PCI_PLL] = GOYA_PCI_PLL, 141 - [EMMC_PLL] = GOYA_EMMC_PLL, 142 - [TPC_PLL] = GOYA_TPC_PLL, 143 - }; 144 - 145 121 static const char goya_irq_name[GOYA_MSIX_ENTRIES][GOYA_MAX_STRING_LEN] = { 146 122 "goya cq 0", "goya cq 1", "goya cq 2", "goya cq 3", 147 123 "goya cq 4", "goya cpu eq" ··· 751 775 freq = 0; 752 776 } 753 777 } else { 754 - rc = hl_fw_cpucp_pll_info_get(hdev, PCI_PLL, pll_freq_arr); 778 + rc = hl_fw_cpucp_pll_info_get(hdev, HL_GOYA_PCI_PLL, 779 + pll_freq_arr); 755 780 756 781 if (rc) 757 782 return; ··· 873 896 goya->ic_clk = GOYA_PLL_FREQ_LOW; 874 897 875 898 hdev->asic_specific = goya; 876 - 877 - /* store legacy PLL map */ 878 - hdev->legacy_pll_map = goya_pll_map; 879 899 880 900 /* Create DMA pool for small allocations */ 881 901 hdev->dma_pool = dma_pool_create(dev_name(hdev->dev), ··· 5486 5512 GOYA_ASYNC_EVENT_ID_INTS_REGISTER); 5487 5513 } 5488 5514 5515 + static int goya_map_pll_idx_to_fw_idx(u32 pll_idx) 5516 + { 5517 + switch (pll_idx) { 5518 + case HL_GOYA_CPU_PLL: return CPU_PLL; 5519 + case HL_GOYA_PCI_PLL: return PCI_PLL; 5520 + case HL_GOYA_MME_PLL: return MME_PLL; 5521 + case HL_GOYA_TPC_PLL: return TPC_PLL; 5522 + case HL_GOYA_IC_PLL: return IC_PLL; 5523 + case HL_GOYA_MC_PLL: return MC_PLL; 5524 + case HL_GOYA_EMMC_PLL: return EMMC_PLL; 5525 + default: return -EINVAL; 5526 + } 5527 + } 5528 + 5489 5529 static const struct hl_asic_funcs goya_funcs = { 5490 5530 .early_init = goya_early_init, 5491 5531 .early_fini = goya_early_fini, ··· 5583 5595 .ack_protection_bits_errors = goya_ack_protection_bits_errors, 5584 5596 .get_hw_block_id = goya_get_hw_block_id, 5585 5597 .hw_block_mmap = goya_block_mmap, 5586 - .enable_events_from_fw = goya_enable_events_from_fw 5598 + .enable_events_from_fw = goya_enable_events_from_fw, 5599 + .map_pll_idx_to_fw_idx = goya_map_pll_idx_to_fw_idx 5587 5600 }; 5588 5601 5589 5602 /*
+20 -20
drivers/misc/habanalabs/goya/goya_hwmgr.c
··· 13 13 14 14 switch (freq) { 15 15 case PLL_HIGH: 16 - hl_set_frequency(hdev, MME_PLL, hdev->high_pll); 17 - hl_set_frequency(hdev, TPC_PLL, hdev->high_pll); 18 - hl_set_frequency(hdev, IC_PLL, hdev->high_pll); 16 + hl_set_frequency(hdev, HL_GOYA_MME_PLL, hdev->high_pll); 17 + hl_set_frequency(hdev, HL_GOYA_TPC_PLL, hdev->high_pll); 18 + hl_set_frequency(hdev, HL_GOYA_IC_PLL, hdev->high_pll); 19 19 break; 20 20 case PLL_LOW: 21 - hl_set_frequency(hdev, MME_PLL, GOYA_PLL_FREQ_LOW); 22 - hl_set_frequency(hdev, TPC_PLL, GOYA_PLL_FREQ_LOW); 23 - hl_set_frequency(hdev, IC_PLL, GOYA_PLL_FREQ_LOW); 21 + hl_set_frequency(hdev, HL_GOYA_MME_PLL, GOYA_PLL_FREQ_LOW); 22 + hl_set_frequency(hdev, HL_GOYA_TPC_PLL, GOYA_PLL_FREQ_LOW); 23 + hl_set_frequency(hdev, HL_GOYA_IC_PLL, GOYA_PLL_FREQ_LOW); 24 24 break; 25 25 case PLL_LAST: 26 - hl_set_frequency(hdev, MME_PLL, goya->mme_clk); 27 - hl_set_frequency(hdev, TPC_PLL, goya->tpc_clk); 28 - hl_set_frequency(hdev, IC_PLL, goya->ic_clk); 26 + hl_set_frequency(hdev, HL_GOYA_MME_PLL, goya->mme_clk); 27 + hl_set_frequency(hdev, HL_GOYA_TPC_PLL, goya->tpc_clk); 28 + hl_set_frequency(hdev, HL_GOYA_IC_PLL, goya->ic_clk); 29 29 break; 30 30 default: 31 31 dev_err(hdev->dev, "unknown frequency setting\n"); ··· 39 39 if (!hl_device_operational(hdev, NULL)) 40 40 return -ENODEV; 41 41 42 - value = hl_get_frequency(hdev, MME_PLL, false); 42 + value = hl_get_frequency(hdev, HL_GOYA_MME_PLL, false); 43 43 44 44 if (value < 0) { 45 45 dev_err(hdev->dev, "Failed to retrieve device max clock %ld\n", ··· 49 49 50 50 *max_clk = (value / 1000 / 1000); 51 51 52 - value = hl_get_frequency(hdev, MME_PLL, true); 52 + value = hl_get_frequency(hdev, HL_GOYA_MME_PLL, true); 53 53 54 54 if (value < 0) { 55 55 dev_err(hdev->dev, ··· 72 72 if (!hl_device_operational(hdev, NULL)) 73 73 return -ENODEV; 74 74 75 - value = hl_get_frequency(hdev, MME_PLL, false); 75 + value = hl_get_frequency(hdev, HL_GOYA_MME_PLL, false); 76 76 77 77 if (value < 0) 78 78 return value; ··· 105 105 goto fail; 106 106 } 107 107 108 - hl_set_frequency(hdev, MME_PLL, value); 108 + hl_set_frequency(hdev, HL_GOYA_MME_PLL, value); 109 109 goya->mme_clk = value; 110 110 111 111 fail: ··· 121 121 if (!hl_device_operational(hdev, NULL)) 122 122 return -ENODEV; 123 123 124 - value = hl_get_frequency(hdev, TPC_PLL, false); 124 + value = hl_get_frequency(hdev, HL_GOYA_TPC_PLL, false); 125 125 126 126 if (value < 0) 127 127 return value; ··· 154 154 goto fail; 155 155 } 156 156 157 - hl_set_frequency(hdev, TPC_PLL, value); 157 + hl_set_frequency(hdev, HL_GOYA_TPC_PLL, value); 158 158 goya->tpc_clk = value; 159 159 160 160 fail: ··· 170 170 if (!hl_device_operational(hdev, NULL)) 171 171 return -ENODEV; 172 172 173 - value = hl_get_frequency(hdev, IC_PLL, false); 173 + value = hl_get_frequency(hdev, HL_GOYA_IC_PLL, false); 174 174 175 175 if (value < 0) 176 176 return value; ··· 203 203 goto fail; 204 204 } 205 205 206 - hl_set_frequency(hdev, IC_PLL, value); 206 + hl_set_frequency(hdev, HL_GOYA_IC_PLL, value); 207 207 goya->ic_clk = value; 208 208 209 209 fail: ··· 219 219 if (!hl_device_operational(hdev, NULL)) 220 220 return -ENODEV; 221 221 222 - value = hl_get_frequency(hdev, MME_PLL, true); 222 + value = hl_get_frequency(hdev, HL_GOYA_MME_PLL, true); 223 223 224 224 if (value < 0) 225 225 return value; ··· 236 236 if (!hl_device_operational(hdev, NULL)) 237 237 return -ENODEV; 238 238 239 - value = hl_get_frequency(hdev, TPC_PLL, true); 239 + value = hl_get_frequency(hdev, HL_GOYA_TPC_PLL, true); 240 240 241 241 if (value < 0) 242 242 return value; ··· 253 253 if (!hl_device_operational(hdev, NULL)) 254 254 return -ENODEV; 255 255 256 - value = hl_get_frequency(hdev, IC_PLL, true); 256 + value = hl_get_frequency(hdev, HL_GOYA_IC_PLL, true); 257 257 258 258 if (value < 0) 259 259 return value;
+1 -1
drivers/misc/ics932s401.c
··· 134 134 for (i = 0; i < NUM_MIRRORED_REGS; i++) { 135 135 temp = i2c_smbus_read_word_data(client, regs_to_copy[i]); 136 136 if (temp < 0) 137 - data->regs[regs_to_copy[i]] = 0; 137 + temp = 0; 138 138 data->regs[regs_to_copy[i]] = temp >> 8; 139 139 } 140 140
-3
drivers/net/caif/caif_serial.c
··· 269 269 { 270 270 struct ser_device *ser; 271 271 272 - if (WARN_ON(!dev)) 273 - return -EINVAL; 274 - 275 272 ser = netdev_priv(dev); 276 273 277 274 /* Send flow off once, on high water mark */
+17 -10
drivers/net/ethernet/cavium/liquidio/lio_main.c
··· 1153 1153 * @lio: per-network private data 1154 1154 * @start_stop: whether to start or stop 1155 1155 */ 1156 - static void send_rx_ctrl_cmd(struct lio *lio, int start_stop) 1156 + static int send_rx_ctrl_cmd(struct lio *lio, int start_stop) 1157 1157 { 1158 1158 struct octeon_soft_command *sc; 1159 1159 union octnet_cmd *ncmd; ··· 1161 1161 int retval; 1162 1162 1163 1163 if (oct->props[lio->ifidx].rx_on == start_stop) 1164 - return; 1164 + return 0; 1165 1165 1166 1166 sc = (struct octeon_soft_command *) 1167 1167 octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, 1168 1168 16, 0); 1169 1169 if (!sc) { 1170 1170 netif_info(lio, rx_err, lio->netdev, 1171 - "Failed to allocate octeon_soft_command\n"); 1172 - return; 1171 + "Failed to allocate octeon_soft_command struct\n"); 1172 + return -ENOMEM; 1173 1173 } 1174 1174 1175 1175 ncmd = (union octnet_cmd *)sc->virtdptr; ··· 1192 1192 if (retval == IQ_SEND_FAILED) { 1193 1193 netif_info(lio, rx_err, lio->netdev, "Failed to send RX Control message\n"); 1194 1194 octeon_free_soft_command(oct, sc); 1195 - return; 1196 1195 } else { 1197 1196 /* Sleep on a wait queue till the cond flag indicates that the 1198 1197 * response arrived or timed-out. 1199 1198 */ 1200 1199 retval = wait_for_sc_completion_timeout(oct, sc, 0); 1201 1200 if (retval) 1202 - return; 1201 + return retval; 1203 1202 1204 1203 oct->props[lio->ifidx].rx_on = start_stop; 1205 1204 WRITE_ONCE(sc->caller_is_done, true); 1206 1205 } 1206 + 1207 + return retval; 1207 1208 } 1208 1209 1209 1210 /** ··· 1779 1778 struct octeon_device_priv *oct_priv = 1780 1779 (struct octeon_device_priv *)oct->priv; 1781 1780 struct napi_struct *napi, *n; 1781 + int ret = 0; 1782 1782 1783 1783 if (oct->props[lio->ifidx].napi_enabled == 0) { 1784 1784 tasklet_disable(&oct_priv->droq_tasklet); ··· 1815 1813 netif_info(lio, ifup, lio->netdev, "Interface Open, ready for traffic\n"); 1816 1814 1817 1815 /* tell Octeon to start forwarding packets to host */ 1818 - send_rx_ctrl_cmd(lio, 1); 1816 + ret = send_rx_ctrl_cmd(lio, 1); 1817 + if (ret) 1818 + return ret; 1819 1819 1820 1820 /* start periodical statistics fetch */ 1821 1821 INIT_DELAYED_WORK(&lio->stats_wk.work, lio_fetch_stats); ··· 1828 1824 dev_info(&oct->pci_dev->dev, "%s interface is opened\n", 1829 1825 netdev->name); 1830 1826 1831 - return 0; 1827 + return ret; 1832 1828 } 1833 1829 1834 1830 /** ··· 1842 1838 struct octeon_device_priv *oct_priv = 1843 1839 (struct octeon_device_priv *)oct->priv; 1844 1840 struct napi_struct *napi, *n; 1841 + int ret = 0; 1845 1842 1846 1843 ifstate_reset(lio, LIO_IFSTATE_RUNNING); 1847 1844 ··· 1859 1854 lio->link_changes++; 1860 1855 1861 1856 /* Tell Octeon that nic interface is down. */ 1862 - send_rx_ctrl_cmd(lio, 0); 1857 + ret = send_rx_ctrl_cmd(lio, 0); 1858 + if (ret) 1859 + return ret; 1863 1860 1864 1861 if (OCTEON_CN23XX_PF(oct)) { 1865 1862 if (!oct->msix_on) ··· 1896 1889 1897 1890 dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name); 1898 1891 1899 - return 0; 1892 + return ret; 1900 1893 } 1901 1894 1902 1895 /**
+20 -7
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
··· 595 595 * @lio: per-network private data 596 596 * @start_stop: whether to start or stop 597 597 */ 598 - static void send_rx_ctrl_cmd(struct lio *lio, int start_stop) 598 + static int send_rx_ctrl_cmd(struct lio *lio, int start_stop) 599 599 { 600 600 struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; 601 601 struct octeon_soft_command *sc; ··· 603 603 int retval; 604 604 605 605 if (oct->props[lio->ifidx].rx_on == start_stop) 606 - return; 606 + return 0; 607 607 608 608 sc = (struct octeon_soft_command *) 609 609 octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, 610 610 16, 0); 611 + if (!sc) { 612 + netif_info(lio, rx_err, lio->netdev, 613 + "Failed to allocate octeon_soft_command struct\n"); 614 + return -ENOMEM; 615 + } 611 616 612 617 ncmd = (union octnet_cmd *)sc->virtdptr; 613 618 ··· 640 635 */ 641 636 retval = wait_for_sc_completion_timeout(oct, sc, 0); 642 637 if (retval) 643 - return; 638 + return retval; 644 639 645 640 oct->props[lio->ifidx].rx_on = start_stop; 646 641 WRITE_ONCE(sc->caller_is_done, true); 647 642 } 643 + 644 + return retval; 648 645 } 649 646 650 647 /** ··· 913 906 struct octeon_device_priv *oct_priv = 914 907 (struct octeon_device_priv *)oct->priv; 915 908 struct napi_struct *napi, *n; 909 + int ret = 0; 916 910 917 911 if (!oct->props[lio->ifidx].napi_enabled) { 918 912 tasklet_disable(&oct_priv->droq_tasklet); ··· 940 932 (LIQUIDIO_NDEV_STATS_POLL_TIME_MS)); 941 933 942 934 /* tell Octeon to start forwarding packets to host */ 943 - send_rx_ctrl_cmd(lio, 1); 935 + ret = send_rx_ctrl_cmd(lio, 1); 936 + if (ret) 937 + return ret; 944 938 945 939 dev_info(&oct->pci_dev->dev, "%s interface is opened\n", netdev->name); 946 940 947 - return 0; 941 + return ret; 948 942 } 949 943 950 944 /** ··· 960 950 struct octeon_device_priv *oct_priv = 961 951 (struct octeon_device_priv *)oct->priv; 962 952 struct napi_struct *napi, *n; 953 + int ret = 0; 963 954 964 955 /* tell Octeon to stop forwarding packets to host */ 965 - send_rx_ctrl_cmd(lio, 0); 956 + ret = send_rx_ctrl_cmd(lio, 0); 957 + if (ret) 958 + return ret; 966 959 967 960 netif_info(lio, ifdown, lio->netdev, "Stopping interface!\n"); 968 961 /* Inform that netif carrier is down */ ··· 999 986 1000 987 dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name); 1001 988 1002 - return 0; 989 + return ret; 1003 990 } 1004 991 1005 992 /**
+2 -2
drivers/net/ethernet/fujitsu/fmvj18x_cs.c
··· 548 548 549 549 base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); 550 550 if (!base) { 551 - pcmcia_release_window(link, link->resource[2]); 552 - return -ENOMEM; 551 + pcmcia_release_window(link, link->resource[2]); 552 + return -1; 553 553 } 554 554 555 555 pcmcia_map_mem_page(link, link->resource[2], 0);
+2 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
··· 1048 1048 for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) { 1049 1049 skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE); 1050 1050 if (!skb) 1051 - break; 1051 + goto error; 1052 1052 qlcnic_create_loopback_buff(skb->data, adapter->mac_addr); 1053 1053 skb_put(skb, QLCNIC_ILB_PKT_SIZE); 1054 1054 adapter->ahw->diag_cnt = 0; ··· 1072 1072 cnt++; 1073 1073 } 1074 1074 if (cnt != i) { 1075 + error: 1075 1076 dev_err(&adapter->pdev->dev, 1076 1077 "LB Test: failed, TX[%d], RX[%d]\n", i, cnt); 1077 1078 if (mode != QLCNIC_ILB_MODE)
+4 -4
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
··· 30 30 static int sun7i_gmac_init(struct platform_device *pdev, void *priv) 31 31 { 32 32 struct sunxi_priv_data *gmac = priv; 33 - int ret; 33 + int ret = 0; 34 34 35 35 if (gmac->regulator) { 36 36 ret = regulator_enable(gmac->regulator); ··· 51 51 } else { 52 52 clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE); 53 53 ret = clk_prepare(gmac->tx_clk); 54 - if (ret) 55 - return ret; 54 + if (ret && gmac->regulator) 55 + regulator_disable(gmac->regulator); 56 56 } 57 57 58 - return 0; 58 + return ret; 59 59 } 60 60 61 61 static void sun7i_gmac_exit(struct platform_device *pdev, void *priv)
+20 -12
drivers/net/ethernet/sun/niu.c
··· 8144 8144 "VPD_SCAN: Reading in property [%s] len[%d]\n", 8145 8145 namebuf, prop_len); 8146 8146 for (i = 0; i < prop_len; i++) { 8147 - err = niu_pci_eeprom_read(np, off + i); 8148 - if (err >= 0) 8149 - *prop_buf = err; 8150 - ++prop_buf; 8147 + err = niu_pci_eeprom_read(np, off + i); 8148 + if (err < 0) 8149 + return err; 8150 + *prop_buf++ = err; 8151 8151 } 8152 8152 } 8153 8153 ··· 8158 8158 } 8159 8159 8160 8160 /* ESPC_PIO_EN_ENABLE must be set */ 8161 - static void niu_pci_vpd_fetch(struct niu *np, u32 start) 8161 + static int niu_pci_vpd_fetch(struct niu *np, u32 start) 8162 8162 { 8163 8163 u32 offset; 8164 8164 int err; 8165 8165 8166 8166 err = niu_pci_eeprom_read16_swp(np, start + 1); 8167 8167 if (err < 0) 8168 - return; 8168 + return err; 8169 8169 8170 8170 offset = err + 3; 8171 8171 ··· 8174 8174 u32 end; 8175 8175 8176 8176 err = niu_pci_eeprom_read(np, here); 8177 + if (err < 0) 8178 + return err; 8177 8179 if (err != 0x90) 8178 - return; 8180 + return -EINVAL; 8179 8181 8180 8182 err = niu_pci_eeprom_read16_swp(np, here + 1); 8181 8183 if (err < 0) 8182 - return; 8184 + return err; 8183 8185 8184 8186 here = start + offset + 3; 8185 8187 end = start + offset + err; ··· 8189 8187 offset += err; 8190 8188 8191 8189 err = niu_pci_vpd_scan_props(np, here, end); 8192 - if (err < 0 || err == 1) 8193 - return; 8190 + if (err < 0) 8191 + return err; 8192 + if (err == 1) 8193 + return -EINVAL; 8194 8194 } 8195 + return 0; 8195 8196 } 8196 8197 8197 8198 /* ESPC_PIO_EN_ENABLE must be set */ ··· 9285 9280 offset = niu_pci_vpd_offset(np); 9286 9281 netif_printk(np, probe, KERN_DEBUG, np->dev, 9287 9282 "%s() VPD offset [%08x]\n", __func__, offset); 9288 - if (offset) 9289 - niu_pci_vpd_fetch(np, offset); 9283 + if (offset) { 9284 + err = niu_pci_vpd_fetch(np, offset); 9285 + if (err < 0) 9286 + return err; 9287 + } 9290 9288 nw64(ESPC_PIO_EN, 0); 9291 9289 9292 9290 if (np->flags & NIU_FLAGS_VPD_VALID) {
+4 -1
drivers/net/wireless/ath/ath6kl/debug.c
··· 1027 1027 { 1028 1028 struct ath6kl *ar = file->private_data; 1029 1029 unsigned long lrssi_roam_threshold; 1030 + int ret; 1030 1031 1031 1032 if (kstrtoul_from_user(user_buf, count, 0, &lrssi_roam_threshold)) 1032 1033 return -EINVAL; 1033 1034 1034 1035 ar->lrssi_roam_threshold = lrssi_roam_threshold; 1035 1036 1036 - ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold); 1037 + ret = ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold); 1037 1038 1039 + if (ret) 1040 + return ret; 1038 1041 return count; 1039 1042 } 1040 1043
+2 -6
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
··· 1217 1217 }, 1218 1218 }; 1219 1219 1220 - void brcmf_sdio_register(void) 1220 + int brcmf_sdio_register(void) 1221 1221 { 1222 - int ret; 1223 - 1224 - ret = sdio_register_driver(&brcmf_sdmmc_driver); 1225 - if (ret) 1226 - brcmf_err("sdio_register_driver failed: %d\n", ret); 1222 + return sdio_register_driver(&brcmf_sdmmc_driver); 1227 1223 } 1228 1224 1229 1225 void brcmf_sdio_exit(void)
+17 -2
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h
··· 275 275 276 276 #ifdef CONFIG_BRCMFMAC_SDIO 277 277 void brcmf_sdio_exit(void); 278 - void brcmf_sdio_register(void); 278 + int brcmf_sdio_register(void); 279 + #else 280 + static inline void brcmf_sdio_exit(void) { } 281 + static inline int brcmf_sdio_register(void) { return 0; } 279 282 #endif 283 + 280 284 #ifdef CONFIG_BRCMFMAC_USB 281 285 void brcmf_usb_exit(void); 282 - void brcmf_usb_register(void); 286 + int brcmf_usb_register(void); 287 + #else 288 + static inline void brcmf_usb_exit(void) { } 289 + static inline int brcmf_usb_register(void) { return 0; } 290 + #endif 291 + 292 + #ifdef CONFIG_BRCMFMAC_PCIE 293 + void brcmf_pcie_exit(void); 294 + int brcmf_pcie_register(void); 295 + #else 296 + static inline void brcmf_pcie_exit(void) { } 297 + static inline int brcmf_pcie_register(void) { return 0; } 283 298 #endif 284 299 285 300 #endif /* BRCMFMAC_BUS_H */
+18 -24
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
··· 1518 1518 } 1519 1519 } 1520 1520 1521 - static void brcmf_driver_register(struct work_struct *work) 1522 - { 1523 - #ifdef CONFIG_BRCMFMAC_SDIO 1524 - brcmf_sdio_register(); 1525 - #endif 1526 - #ifdef CONFIG_BRCMFMAC_USB 1527 - brcmf_usb_register(); 1528 - #endif 1529 - #ifdef CONFIG_BRCMFMAC_PCIE 1530 - brcmf_pcie_register(); 1531 - #endif 1532 - } 1533 - static DECLARE_WORK(brcmf_driver_work, brcmf_driver_register); 1534 - 1535 1521 int __init brcmf_core_init(void) 1536 1522 { 1537 - if (!schedule_work(&brcmf_driver_work)) 1538 - return -EBUSY; 1523 + int err; 1539 1524 1525 + err = brcmf_sdio_register(); 1526 + if (err) 1527 + return err; 1528 + 1529 + err = brcmf_usb_register(); 1530 + if (err) 1531 + goto error_usb_register; 1532 + 1533 + err = brcmf_pcie_register(); 1534 + if (err) 1535 + goto error_pcie_register; 1540 1536 return 0; 1537 + 1538 + error_pcie_register: 1539 + brcmf_usb_exit(); 1540 + error_usb_register: 1541 + brcmf_sdio_exit(); 1542 + return err; 1541 1543 } 1542 1544 1543 1545 void __exit brcmf_core_exit(void) 1544 1546 { 1545 - cancel_work_sync(&brcmf_driver_work); 1546 - 1547 - #ifdef CONFIG_BRCMFMAC_SDIO 1548 1547 brcmf_sdio_exit(); 1549 - #endif 1550 - #ifdef CONFIG_BRCMFMAC_USB 1551 1548 brcmf_usb_exit(); 1552 - #endif 1553 - #ifdef CONFIG_BRCMFMAC_PCIE 1554 1549 brcmf_pcie_exit(); 1555 - #endif 1556 1550 } 1557 1551
+2 -7
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
··· 2140 2140 }; 2141 2141 2142 2142 2143 - void brcmf_pcie_register(void) 2143 + int brcmf_pcie_register(void) 2144 2144 { 2145 - int err; 2146 - 2147 2145 brcmf_dbg(PCIE, "Enter\n"); 2148 - err = pci_register_driver(&brcmf_pciedrvr); 2149 - if (err) 2150 - brcmf_err(NULL, "PCIE driver registration failed, err=%d\n", 2151 - err); 2146 + return pci_register_driver(&brcmf_pciedrvr); 2152 2147 } 2153 2148 2154 2149
-5
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.h
··· 11 11 struct brcmf_pciedev_info *devinfo; 12 12 }; 13 13 14 - 15 - void brcmf_pcie_exit(void); 16 - void brcmf_pcie_register(void); 17 - 18 - 19 14 #endif /* BRCMFMAC_PCIE_H */
+2 -6
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
··· 1584 1584 usb_deregister(&brcmf_usbdrvr); 1585 1585 } 1586 1586 1587 - void brcmf_usb_register(void) 1587 + int brcmf_usb_register(void) 1588 1588 { 1589 - int ret; 1590 - 1591 1589 brcmf_dbg(USB, "Enter\n"); 1592 - ret = usb_register(&brcmf_usbdrvr); 1593 - if (ret) 1594 - brcmf_err("usb_register failed %d\n", ret); 1590 + return usb_register(&brcmf_usbdrvr); 1595 1591 }
+4 -29
drivers/net/wireless/marvell/libertas/mesh.c
··· 801 801 .attrs = mesh_ie_attrs, 802 802 }; 803 803 804 - static void lbs_persist_config_init(struct net_device *dev) 805 - { 806 - int ret; 807 - ret = sysfs_create_group(&(dev->dev.kobj), &boot_opts_group); 808 - if (ret) 809 - pr_err("failed to create boot_opts_group.\n"); 810 - 811 - ret = sysfs_create_group(&(dev->dev.kobj), &mesh_ie_group); 812 - if (ret) 813 - pr_err("failed to create mesh_ie_group.\n"); 814 - } 815 - 816 - static void lbs_persist_config_remove(struct net_device *dev) 817 - { 818 - sysfs_remove_group(&(dev->dev.kobj), &boot_opts_group); 819 - sysfs_remove_group(&(dev->dev.kobj), &mesh_ie_group); 820 - } 821 - 822 804 823 805 /*************************************************************************** 824 806 * Initializing and starting, stopping mesh ··· 996 1014 SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); 997 1015 998 1016 mesh_dev->flags |= IFF_BROADCAST | IFF_MULTICAST; 1017 + mesh_dev->sysfs_groups[0] = &lbs_mesh_attr_group; 1018 + mesh_dev->sysfs_groups[1] = &boot_opts_group; 1019 + mesh_dev->sysfs_groups[2] = &mesh_ie_group; 1020 + 999 1021 /* Register virtual mesh interface */ 1000 1022 ret = register_netdev(mesh_dev); 1001 1023 if (ret) { ··· 1007 1021 goto err_free_netdev; 1008 1022 } 1009 1023 1010 - ret = sysfs_create_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); 1011 - if (ret) 1012 - goto err_unregister; 1013 - 1014 - lbs_persist_config_init(mesh_dev); 1015 - 1016 1024 /* Everything successful */ 1017 1025 ret = 0; 1018 1026 goto done; 1019 - 1020 - err_unregister: 1021 - unregister_netdev(mesh_dev); 1022 1027 1023 1028 err_free_netdev: 1024 1029 free_netdev(mesh_dev); ··· 1031 1054 1032 1055 netif_stop_queue(mesh_dev); 1033 1056 netif_carrier_off(mesh_dev); 1034 - sysfs_remove_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group); 1035 - lbs_persist_config_remove(mesh_dev); 1036 1057 unregister_netdev(mesh_dev); 1037 1058 priv->mesh_dev = NULL; 1038 1059 kfree(mesh_dev->ieee80211_ptr);
+9 -9
drivers/net/wireless/realtek/rtlwifi/base.c
··· 440 440 static void rtl_fwevt_wq_callback(struct work_struct *work); 441 441 static void rtl_c2hcmd_wq_callback(struct work_struct *work); 442 442 443 - static void _rtl_init_deferred_work(struct ieee80211_hw *hw) 443 + static int _rtl_init_deferred_work(struct ieee80211_hw *hw) 444 444 { 445 445 struct rtl_priv *rtlpriv = rtl_priv(hw); 446 + struct workqueue_struct *wq; 447 + 448 + wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); 449 + if (!wq) 450 + return -ENOMEM; 446 451 447 452 /* <1> timer */ 448 453 timer_setup(&rtlpriv->works.watchdog_timer, ··· 456 451 rtl_easy_concurrent_retrytimer_callback, 0); 457 452 /* <2> work queue */ 458 453 rtlpriv->works.hw = hw; 459 - rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); 460 - if (unlikely(!rtlpriv->works.rtl_wq)) { 461 - pr_err("Failed to allocate work queue\n"); 462 - return; 463 - } 454 + rtlpriv->works.rtl_wq = wq; 464 455 465 456 INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, 466 457 rtl_watchdog_wq_callback); ··· 467 466 rtl_swlps_rfon_wq_callback); 468 467 INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, rtl_fwevt_wq_callback); 469 468 INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq, rtl_c2hcmd_wq_callback); 469 + return 0; 470 470 } 471 471 472 472 void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq) ··· 566 564 rtlmac->link_state = MAC80211_NOLINK; 567 565 568 566 /* <6> init deferred work */ 569 - _rtl_init_deferred_work(hw); 570 - 571 - return 0; 567 + return _rtl_init_deferred_work(hw); 572 568 } 573 569 EXPORT_SYMBOL_GPL(rtl_init_core); 574 570
+8 -9
drivers/rapidio/rio_cm.c
··· 2127 2127 return -ENODEV; 2128 2128 } 2129 2129 2130 + cm->rx_wq = create_workqueue(DRV_NAME "/rxq"); 2131 + if (!cm->rx_wq) { 2132 + rio_release_inb_mbox(mport, cmbox); 2133 + rio_release_outb_mbox(mport, cmbox); 2134 + kfree(cm); 2135 + return -ENOMEM; 2136 + } 2137 + 2130 2138 /* 2131 2139 * Allocate and register inbound messaging buffers to be ready 2132 2140 * to receive channel and system management requests ··· 2145 2137 cm->rx_slots = RIOCM_RX_RING_SIZE; 2146 2138 mutex_init(&cm->rx_lock); 2147 2139 riocm_rx_fill(cm, RIOCM_RX_RING_SIZE); 2148 - cm->rx_wq = create_workqueue(DRV_NAME "/rxq"); 2149 - if (!cm->rx_wq) { 2150 - riocm_error("failed to allocate IBMBOX_%d on %s", 2151 - cmbox, mport->name); 2152 - rio_release_outb_mbox(mport, cmbox); 2153 - kfree(cm); 2154 - return -ENOMEM; 2155 - } 2156 - 2157 2140 INIT_WORK(&cm->rx_work, rio_ibmsg_handler); 2158 2141 2159 2142 cm->tx_slot = 0;
+9 -6
drivers/scsi/ufs/ufs-hisi.c
··· 467 467 host->hba = hba; 468 468 ufshcd_set_variant(hba, host); 469 469 470 - host->rst = devm_reset_control_get(dev, "rst"); 470 + host->rst = devm_reset_control_get(dev, "rst"); 471 471 if (IS_ERR(host->rst)) { 472 472 dev_err(dev, "%s: failed to get reset control\n", __func__); 473 - return PTR_ERR(host->rst); 473 + err = PTR_ERR(host->rst); 474 + goto error; 474 475 } 475 476 476 477 ufs_hisi_set_pm_lvl(hba); 477 478 478 479 err = ufs_hisi_get_resource(host); 479 - if (err) { 480 - ufshcd_set_variant(hba, NULL); 481 - return err; 482 - } 480 + if (err) 481 + goto error; 483 482 484 483 return 0; 484 + 485 + error: 486 + ufshcd_set_variant(hba, NULL); 487 + return err; 485 488 } 486 489 487 490 static int ufs_hi3660_init(struct ufs_hba *hba)
+2
drivers/tty/serial/max310x.c
··· 1519 1519 1520 1520 #ifdef CONFIG_SPI_MASTER 1521 1521 ret = spi_register_driver(&max310x_spi_driver); 1522 + if (ret) 1523 + uart_unregister_driver(&max310x_uart); 1522 1524 #endif 1523 1525 1524 1526 return ret;
-3
drivers/tty/serial/mvebu-uart.c
··· 818 818 return -EINVAL; 819 819 } 820 820 821 - if (!match) 822 - return -ENODEV; 823 - 824 821 /* Assume that all UART ports have a DT alias or none has */ 825 822 id = of_alias_get_id(pdev->dev.of_node, "serial"); 826 823 if (!pdev->dev.of_node || id < 0)
+9 -3
drivers/uio/uio_hv_generic.c
··· 291 291 pdata->recv_buf = vzalloc(RECV_BUFFER_SIZE); 292 292 if (pdata->recv_buf == NULL) { 293 293 ret = -ENOMEM; 294 - goto fail_close; 294 + goto fail_free_ring; 295 295 } 296 296 297 297 ret = vmbus_establish_gpadl(channel, pdata->recv_buf, 298 298 RECV_BUFFER_SIZE, &pdata->recv_gpadl); 299 - if (ret) 299 + if (ret) { 300 + vfree(pdata->recv_buf); 300 301 goto fail_close; 302 + } 301 303 302 304 /* put Global Physical Address Label in name */ 303 305 snprintf(pdata->recv_name, sizeof(pdata->recv_name), ··· 318 316 319 317 ret = vmbus_establish_gpadl(channel, pdata->send_buf, 320 318 SEND_BUFFER_SIZE, &pdata->send_gpadl); 321 - if (ret) 319 + if (ret) { 320 + vfree(pdata->send_buf); 322 321 goto fail_close; 322 + } 323 323 324 324 snprintf(pdata->send_name, sizeof(pdata->send_name), 325 325 "send:%u", pdata->send_gpadl); ··· 351 347 352 348 fail_close: 353 349 hv_uio_cleanup(dev, pdata); 350 + fail_free_ring: 351 + vmbus_free_ring(dev->channel); 354 352 355 353 return ret; 356 354 }
+1 -1
drivers/uio/uio_pci_generic.c
··· 82 82 } 83 83 84 84 if (pdev->irq && !pci_intx_mask_supported(pdev)) 85 - return -ENOMEM; 85 + return -ENODEV; 86 86 87 87 gdev = devm_kzalloc(&pdev->dev, sizeof(struct uio_pci_generic_dev), GFP_KERNEL); 88 88 if (!gdev)
+12 -9
drivers/video/fbdev/hgafb.c
··· 286 286 287 287 hga_vram = ioremap(0xb0000, hga_vram_len); 288 288 if (!hga_vram) 289 - goto error; 289 + return -ENOMEM; 290 290 291 291 if (request_region(0x3b0, 12, "hgafb")) 292 292 release_io_ports = 1; ··· 346 346 hga_type_name = "Hercules"; 347 347 break; 348 348 } 349 - return 1; 349 + return 0; 350 350 error: 351 351 if (release_io_ports) 352 352 release_region(0x3b0, 12); 353 353 if (release_io_port) 354 354 release_region(0x3bf, 1); 355 - return 0; 355 + 356 + iounmap(hga_vram); 357 + 358 + pr_err("hgafb: HGA card not detected.\n"); 359 + 360 + return -EINVAL; 356 361 } 357 362 358 363 /** ··· 555 550 static int hgafb_probe(struct platform_device *pdev) 556 551 { 557 552 struct fb_info *info; 553 + int ret; 558 554 559 - if (! hga_card_detect()) { 560 - printk(KERN_INFO "hgafb: HGA card not detected.\n"); 561 - if (hga_vram) 562 - iounmap(hga_vram); 563 - return -EINVAL; 564 - } 555 + ret = hga_card_detect(); 556 + if (!ret) 557 + return ret; 565 558 566 559 printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n", 567 560 hga_type_name, hga_vram_len/1024);
+18 -8
drivers/video/fbdev/imsttfb.c
··· 1469 1469 struct imstt_par *par; 1470 1470 struct fb_info *info; 1471 1471 struct device_node *dp; 1472 + int ret = -ENOMEM; 1472 1473 1473 1474 dp = pci_device_to_OF_node(pdev); 1474 1475 if(dp) ··· 1505 1504 default: 1506 1505 printk(KERN_INFO "imsttfb: Device 0x%x unknown, " 1507 1506 "contact maintainer.\n", pdev->device); 1508 - release_mem_region(addr, size); 1509 - framebuffer_release(info); 1510 - return -ENODEV; 1507 + ret = -ENODEV; 1508 + goto error; 1511 1509 } 1512 1510 1513 1511 info->fix.smem_start = addr; 1514 1512 info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? 1515 1513 0x400000 : 0x800000); 1516 - if (!info->screen_base) { 1517 - release_mem_region(addr, size); 1518 - framebuffer_release(info); 1519 - return -ENOMEM; 1520 - } 1514 + if (!info->screen_base) 1515 + goto error; 1521 1516 info->fix.mmio_start = addr + 0x800000; 1522 1517 par->dc_regs = ioremap(addr + 0x800000, 0x1000); 1518 + if (!par->dc_regs) 1519 + goto error; 1523 1520 par->cmap_regs_phys = addr + 0x840000; 1524 1521 par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); 1522 + if (!par->cmap_regs) 1523 + goto error; 1525 1524 info->pseudo_palette = par->palette; 1526 1525 init_imstt(info); 1527 1526 1528 1527 pci_set_drvdata(pdev, info); 1529 1528 return 0; 1529 + 1530 + error: 1531 + if (par->dc_regs) 1532 + iounmap(par->dc_regs); 1533 + if (info->screen_base) 1534 + iounmap(info->screen_base); 1535 + release_mem_region(addr, size); 1536 + framebuffer_release(info); 1537 + return ret; 1530 1538 } 1531 1539 1532 1540 static void imsttfb_remove(struct pci_dev *pdev)
-4
fs/ecryptfs/crypto.c
··· 296 296 struct extent_crypt_result ecr; 297 297 int rc = 0; 298 298 299 - if (!crypt_stat || !crypt_stat->tfm 300 - || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED)) 301 - return -EINVAL; 302 - 303 299 if (unlikely(ecryptfs_verbosity > 0)) { 304 300 ecryptfs_printk(KERN_DEBUG, "Key size [%zd]; key:\n", 305 301 crypt_stat->key_size);
+5
include/linux/dynamic_debug.h
··· 32 32 #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) 33 33 #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) 34 34 #define _DPRINTK_FLAGS_INCL_TID (1<<4) 35 + 36 + #define _DPRINTK_FLAGS_INCL_ANY \ 37 + (_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\ 38 + _DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID) 39 + 35 40 #if defined DEBUG 36 41 #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT 37 42 #else
+33
include/uapi/misc/habanalabs.h
··· 239 239 GAUDI_ENGINE_ID_SIZE 240 240 }; 241 241 242 + /* 243 + * ASIC specific PLL index 244 + * 245 + * Used to retrieve in frequency info of different IPs via 246 + * HL_INFO_PLL_FREQUENCY under HL_IOCTL_INFO IOCTL. The enums need to be 247 + * used as an index in struct hl_pll_frequency_info 248 + */ 249 + 250 + enum hl_goya_pll_index { 251 + HL_GOYA_CPU_PLL = 0, 252 + HL_GOYA_IC_PLL, 253 + HL_GOYA_MC_PLL, 254 + HL_GOYA_MME_PLL, 255 + HL_GOYA_PCI_PLL, 256 + HL_GOYA_EMMC_PLL, 257 + HL_GOYA_TPC_PLL, 258 + HL_GOYA_PLL_MAX 259 + }; 260 + 261 + enum hl_gaudi_pll_index { 262 + HL_GAUDI_CPU_PLL = 0, 263 + HL_GAUDI_PCI_PLL, 264 + HL_GAUDI_SRAM_PLL, 265 + HL_GAUDI_HBM_PLL, 266 + HL_GAUDI_NIC_PLL, 267 + HL_GAUDI_DMA_PLL, 268 + HL_GAUDI_MESH_PLL, 269 + HL_GAUDI_MME_PLL, 270 + HL_GAUDI_TPC_PLL, 271 + HL_GAUDI_IF_PLL, 272 + HL_GAUDI_PLL_MAX 273 + }; 274 + 242 275 enum hl_device_status { 243 276 HL_DEVICE_STATUS_OPERATIONAL, 244 277 HL_DEVICE_STATUS_IN_RESET,
+12 -8
lib/dynamic_debug.c
··· 586 586 return 0; 587 587 } 588 588 589 - static char *dynamic_emit_prefix(const struct _ddebug *desc, char *buf) 589 + static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf) 590 590 { 591 591 int pos_after_tid; 592 592 int pos = 0; 593 - 594 - *buf = '\0'; 595 593 596 594 if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { 597 595 if (in_interrupt()) ··· 616 618 return buf; 617 619 } 618 620 621 + static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf) 622 + { 623 + if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_ANY)) 624 + return __dynamic_emit_prefix(desc, buf); 625 + return buf; 626 + } 627 + 619 628 void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) 620 629 { 621 630 va_list args; 622 631 struct va_format vaf; 623 - char buf[PREFIX_SIZE]; 632 + char buf[PREFIX_SIZE] = ""; 624 633 625 634 BUG_ON(!descriptor); 626 635 BUG_ON(!fmt); ··· 660 655 if (!dev) { 661 656 printk(KERN_DEBUG "(NULL device *): %pV", &vaf); 662 657 } else { 663 - char buf[PREFIX_SIZE]; 658 + char buf[PREFIX_SIZE] = ""; 664 659 665 660 dev_printk_emit(LOGLEVEL_DEBUG, dev, "%s%s %s: %pV", 666 661 dynamic_emit_prefix(descriptor, buf), ··· 689 684 vaf.va = &args; 690 685 691 686 if (dev && dev->dev.parent) { 692 - char buf[PREFIX_SIZE]; 687 + char buf[PREFIX_SIZE] = ""; 693 688 694 689 dev_printk_emit(LOGLEVEL_DEBUG, dev->dev.parent, 695 690 "%s%s %s %s%s: %pV", ··· 725 720 vaf.va = &args; 726 721 727 722 if (ibdev && ibdev->dev.parent) { 728 - char buf[PREFIX_SIZE]; 723 + char buf[PREFIX_SIZE] = ""; 729 724 730 725 dev_printk_emit(LOGLEVEL_DEBUG, ibdev->dev.parent, 731 726 "%s%s %s %s: %pV", ··· 920 915 921 916 static int ddebug_proc_open(struct inode *inode, struct file *file) 922 917 { 923 - vpr_info("called\n"); 924 918 return seq_open_private(file, &ddebug_proc_seqops, 925 919 sizeof(struct ddebug_iter)); 926 920 }
+8 -7
net/smc/smc_ism.c
··· 402 402 return NULL; 403 403 } 404 404 405 + smcd->event_wq = alloc_ordered_workqueue("ism_evt_wq-%s)", 406 + WQ_MEM_RECLAIM, name); 407 + if (!smcd->event_wq) { 408 + kfree(smcd->conn); 409 + kfree(smcd); 410 + return NULL; 411 + } 412 + 405 413 smcd->dev.parent = parent; 406 414 smcd->dev.release = smcd_release; 407 415 device_initialize(&smcd->dev); ··· 423 415 INIT_LIST_HEAD(&smcd->vlan); 424 416 INIT_LIST_HEAD(&smcd->lgr_list); 425 417 init_waitqueue_head(&smcd->lgrs_deleted); 426 - smcd->event_wq = alloc_ordered_workqueue("ism_evt_wq-%s)", 427 - WQ_MEM_RECLAIM, name); 428 - if (!smcd->event_wq) { 429 - kfree(smcd->conn); 430 - kfree(smcd); 431 - return NULL; 432 - } 433 418 return smcd; 434 419 } 435 420 EXPORT_SYMBOL_GPL(smcd_alloc_dev);
+2 -11
sound/isa/gus/gus_main.c
··· 77 77 78 78 static void snd_gus_init_control(struct snd_gus_card *gus) 79 79 { 80 - int ret; 81 - 82 - if (!gus->ace_flag) { 83 - ret = 84 - snd_ctl_add(gus->card, 85 - snd_ctl_new1(&snd_gus_joystick_control, 86 - gus)); 87 - if (ret) 88 - snd_printk(KERN_ERR "gus: snd_ctl_add failed: %d\n", 89 - ret); 90 - } 80 + if (!gus->ace_flag) 81 + snd_ctl_add(gus->card, snd_ctl_new1(&snd_gus_joystick_control, gus)); 91 82 } 92 83 93 84 /*
+3 -7
sound/isa/sb/sb16_main.c
··· 846 846 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops); 847 847 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops); 848 848 849 - if (chip->dma16 >= 0 && chip->dma8 != chip->dma16) { 850 - err = snd_ctl_add(card, snd_ctl_new1( 851 - &snd_sb16_dma_control, chip)); 852 - if (err) 853 - return err; 854 - } else { 849 + if (chip->dma16 >= 0 && chip->dma8 != chip->dma16) 850 + snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip)); 851 + else 855 852 pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; 856 - } 857 853 858 854 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 859 855 card->dev, 64*1024, 128*1024);
+5 -5
sound/isa/sb/sb8.c
··· 93 93 acard = card->private_data; 94 94 card->private_free = snd_sb8_free; 95 95 96 - /* block the 0x388 port to avoid PnP conflicts */ 96 + /* 97 + * Block the 0x388 port to avoid PnP conflicts. 98 + * No need to check this value after request_region, 99 + * as we never do anything with it. 100 + */ 97 101 acard->fm_res = request_region(0x388, 4, "SoundBlaster FM"); 98 - if (!acard->fm_res) { 99 - err = -EBUSY; 100 - goto _err; 101 - } 102 102 103 103 if (port[dev] != SNDRV_AUTO_PORT) { 104 104 if ((err = snd_sbdsp_create(card, port[dev], irq[dev],
+13 -15
sound/soc/codecs/cs43130.c
··· 1735 1735 static DEVICE_ATTR(hpload_ac_l, 0444, cs43130_show_ac_l, NULL); 1736 1736 static DEVICE_ATTR(hpload_ac_r, 0444, cs43130_show_ac_r, NULL); 1737 1737 1738 + static struct attribute *hpload_attrs[] = { 1739 + &dev_attr_hpload_dc_l.attr, 1740 + &dev_attr_hpload_dc_r.attr, 1741 + &dev_attr_hpload_ac_l.attr, 1742 + &dev_attr_hpload_ac_r.attr, 1743 + }; 1744 + ATTRIBUTE_GROUPS(hpload); 1745 + 1738 1746 static struct reg_sequence hp_en_cal_seq[] = { 1739 1747 {CS43130_INT_MASK_4, CS43130_INT_MASK_ALL}, 1740 1748 {CS43130_HP_MEAS_LOAD_1, 0}, ··· 2310 2302 2311 2303 cs43130->hpload_done = false; 2312 2304 if (cs43130->dc_meas) { 2313 - ret = device_create_file(component->dev, &dev_attr_hpload_dc_l); 2314 - if (ret < 0) 2315 - return ret; 2316 - 2317 - ret = device_create_file(component->dev, &dev_attr_hpload_dc_r); 2318 - if (ret < 0) 2319 - return ret; 2320 - 2321 - ret = device_create_file(component->dev, &dev_attr_hpload_ac_l); 2322 - if (ret < 0) 2323 - return ret; 2324 - 2325 - ret = device_create_file(component->dev, &dev_attr_hpload_ac_r); 2326 - if (ret < 0) 2305 + ret = sysfs_create_groups(&component->dev->kobj, hpload_groups); 2306 + if (ret) 2327 2307 return ret; 2328 2308 2329 2309 cs43130->wq = create_singlethread_workqueue("cs43130_hp"); 2330 - if (!cs43130->wq) 2310 + if (!cs43130->wq) { 2311 + sysfs_remove_groups(&component->dev->kobj, hpload_groups); 2331 2312 return -ENOMEM; 2313 + } 2332 2314 INIT_WORK(&cs43130->work, cs43130_imp_meas); 2333 2315 } 2334 2316
+38 -11
sound/soc/codecs/rt5645.c
··· 3388 3388 { 3389 3389 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); 3390 3390 struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); 3391 + int ret = 0; 3391 3392 3392 3393 rt5645->component = component; 3393 3394 3394 3395 switch (rt5645->codec_type) { 3395 3396 case CODEC_TYPE_RT5645: 3396 - snd_soc_dapm_new_controls(dapm, 3397 + ret = snd_soc_dapm_new_controls(dapm, 3397 3398 rt5645_specific_dapm_widgets, 3398 3399 ARRAY_SIZE(rt5645_specific_dapm_widgets)); 3399 - snd_soc_dapm_add_routes(dapm, 3400 + if (ret < 0) 3401 + goto exit; 3402 + 3403 + ret = snd_soc_dapm_add_routes(dapm, 3400 3404 rt5645_specific_dapm_routes, 3401 3405 ARRAY_SIZE(rt5645_specific_dapm_routes)); 3406 + if (ret < 0) 3407 + goto exit; 3408 + 3402 3409 if (rt5645->v_id < 3) { 3403 - snd_soc_dapm_add_routes(dapm, 3410 + ret = snd_soc_dapm_add_routes(dapm, 3404 3411 rt5645_old_dapm_routes, 3405 3412 ARRAY_SIZE(rt5645_old_dapm_routes)); 3413 + if (ret < 0) 3414 + goto exit; 3406 3415 } 3407 3416 break; 3408 3417 case CODEC_TYPE_RT5650: 3409 - snd_soc_dapm_new_controls(dapm, 3418 + ret = snd_soc_dapm_new_controls(dapm, 3410 3419 rt5650_specific_dapm_widgets, 3411 3420 ARRAY_SIZE(rt5650_specific_dapm_widgets)); 3412 - snd_soc_dapm_add_routes(dapm, 3421 + if (ret < 0) 3422 + goto exit; 3423 + 3424 + ret = snd_soc_dapm_add_routes(dapm, 3413 3425 rt5650_specific_dapm_routes, 3414 3426 ARRAY_SIZE(rt5650_specific_dapm_routes)); 3427 + if (ret < 0) 3428 + goto exit; 3415 3429 break; 3416 3430 } 3417 3431 ··· 3433 3419 3434 3420 /* for JD function */ 3435 3421 if (rt5645->pdata.jd_mode) { 3436 - snd_soc_dapm_force_enable_pin(dapm, "JD Power"); 3437 - snd_soc_dapm_force_enable_pin(dapm, "LDO2"); 3438 - snd_soc_dapm_sync(dapm); 3422 + ret = snd_soc_dapm_force_enable_pin(dapm, "JD Power"); 3423 + if (ret < 0) 3424 + goto exit; 3425 + 3426 + ret = snd_soc_dapm_force_enable_pin(dapm, "LDO2"); 3427 + if (ret < 0) 3428 + goto exit; 3429 + 3430 + ret = snd_soc_dapm_sync(dapm); 3431 + if (ret < 0) 3432 + goto exit; 3439 3433 } 3440 3434 3441 3435 if (rt5645->pdata.long_name) ··· 3454 3432 GFP_KERNEL); 3455 3433 3456 3434 if (!rt5645->eq_param) 3457 - return -ENOMEM; 3458 - 3459 - return 0; 3435 + ret = -ENOMEM; 3436 + exit: 3437 + /* 3438 + * If there was an error above, everything will be cleaned up by the 3439 + * caller if we return an error here. This will be done with a later 3440 + * call to rt5645_remove(). 3441 + */ 3442 + return ret; 3460 3443 } 3461 3444 3462 3445 static void rt5645_remove(struct snd_soc_component *component)