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

pch_phub: fix error return code in pch_phub_probe()

Error code had been assigned to retval in some error handling case
but never use it, 0 is always returned in those case, this patch
fix them to return a negative error code.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Wei Yongjun and committed by
Greg Kroah-Hartman
29ddae2a f7b41276

+17 -19
+17 -19
drivers/misc/pch_phub.c
··· 665 665 static int pch_phub_probe(struct pci_dev *pdev, 666 666 const struct pci_device_id *id) 667 667 { 668 - int retval; 669 - 670 668 int ret; 671 669 struct pch_phub_reg *chip; 672 670 ··· 707 709 if (id->driver_data == 1) { /* EG20T PCH */ 708 710 const char *board_name; 709 711 710 - retval = sysfs_create_file(&pdev->dev.kobj, 711 - &dev_attr_pch_mac.attr); 712 - if (retval) 712 + ret = sysfs_create_file(&pdev->dev.kobj, 713 + &dev_attr_pch_mac.attr); 714 + if (ret) 713 715 goto err_sysfs_create; 714 716 715 - retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 716 - if (retval) 717 + ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 718 + if (ret) 717 719 goto exit_bin_attr; 718 720 719 721 pch_phub_read_modify_write_reg(chip, ··· 737 739 chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T; 738 740 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T; 739 741 } else if (id->driver_data == 2) { /* ML7213 IOH */ 740 - retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 741 - if (retval) 742 + ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 743 + if (ret) 742 744 goto err_sysfs_create; 743 745 /* set the prefech value 744 746 * Device2(USB OHCI #1/ USB EHCI #1/ USB Device):a ··· 760 762 PCH_PHUB_ROM_START_ADDR_ML7223; 761 763 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; 762 764 } else if (id->driver_data == 4) { /* ML7223 IOH Bus-n*/ 763 - retval = sysfs_create_file(&pdev->dev.kobj, 764 - &dev_attr_pch_mac.attr); 765 - if (retval) 765 + ret = sysfs_create_file(&pdev->dev.kobj, 766 + &dev_attr_pch_mac.attr); 767 + if (ret) 766 768 goto err_sysfs_create; 767 - retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 768 - if (retval) 769 + ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 770 + if (ret) 769 771 goto exit_bin_attr; 770 772 /* set the prefech value 771 773 * Device2(USB OHCI #0,1,2,3/ USB EHCI #0):a ··· 777 779 PCH_PHUB_ROM_START_ADDR_ML7223; 778 780 chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; 779 781 } else if (id->driver_data == 5) { /* ML7831 */ 780 - retval = sysfs_create_file(&pdev->dev.kobj, 781 - &dev_attr_pch_mac.attr); 782 - if (retval) 782 + ret = sysfs_create_file(&pdev->dev.kobj, 783 + &dev_attr_pch_mac.attr); 784 + if (ret) 783 785 goto err_sysfs_create; 784 786 785 - retval = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 786 - if (retval) 787 + ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 788 + if (ret) 787 789 goto exit_bin_attr; 788 790 789 791 /* set the prefech value */