diff options
Diffstat (limited to 'drivers/misc/genwqe/card_base.c')
-rw-r--r-- | drivers/misc/genwqe/card_base.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c index 43bbabc96b6c..4cf8f82cfca2 100644 --- a/drivers/misc/genwqe/card_base.c +++ b/drivers/misc/genwqe/card_base.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> | 6 | * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> |
7 | * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> | 7 | * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> |
8 | * Author: Michael Jung <mijung@de.ibm.com> | 8 | * Author: Michael Jung <mijung@gmx.net> |
9 | * Author: Michael Ruettger <michael@ibmra.de> | 9 | * Author: Michael Ruettger <michael@ibmra.de> |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
@@ -45,10 +45,10 @@ | |||
45 | MODULE_AUTHOR("Frank Haverkamp <haver@linux.vnet.ibm.com>"); | 45 | MODULE_AUTHOR("Frank Haverkamp <haver@linux.vnet.ibm.com>"); |
46 | MODULE_AUTHOR("Michael Ruettger <michael@ibmra.de>"); | 46 | MODULE_AUTHOR("Michael Ruettger <michael@ibmra.de>"); |
47 | MODULE_AUTHOR("Joerg-Stephan Vogt <jsvogt@de.ibm.com>"); | 47 | MODULE_AUTHOR("Joerg-Stephan Vogt <jsvogt@de.ibm.com>"); |
48 | MODULE_AUTHOR("Michal Jung <mijung@de.ibm.com>"); | 48 | MODULE_AUTHOR("Michael Jung <mijung@gmx.net>"); |
49 | 49 | ||
50 | MODULE_DESCRIPTION("GenWQE Card"); | 50 | MODULE_DESCRIPTION("GenWQE Card"); |
51 | MODULE_VERSION(DRV_VERS_STRING); | 51 | MODULE_VERSION(DRV_VERSION); |
52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
53 | 53 | ||
54 | static char genwqe_driver_name[] = GENWQE_DEVNAME; | 54 | static char genwqe_driver_name[] = GENWQE_DEVNAME; |
@@ -346,8 +346,13 @@ static bool genwqe_setup_vf_jtimer(struct genwqe_dev *cd) | |||
346 | unsigned int vf; | 346 | unsigned int vf; |
347 | u32 T = genwqe_T_psec(cd); | 347 | u32 T = genwqe_T_psec(cd); |
348 | u64 x; | 348 | u64 x; |
349 | int totalvfs; | ||
349 | 350 | ||
350 | for (vf = 0; vf < pci_sriov_get_totalvfs(pci_dev); vf++) { | 351 | totalvfs = pci_sriov_get_totalvfs(pci_dev); |
352 | if (totalvfs <= 0) | ||
353 | return false; | ||
354 | |||
355 | for (vf = 0; vf < totalvfs; vf++) { | ||
351 | 356 | ||
352 | if (cd->vf_jobtimeout_msec[vf] == 0) | 357 | if (cd->vf_jobtimeout_msec[vf] == 0) |
353 | continue; | 358 | continue; |
@@ -383,8 +388,9 @@ static int genwqe_ffdc_buffs_alloc(struct genwqe_dev *cd) | |||
383 | 388 | ||
384 | /* currently support only the debug units mentioned here */ | 389 | /* currently support only the debug units mentioned here */ |
385 | cd->ffdc[type].entries = e; | 390 | cd->ffdc[type].entries = e; |
386 | cd->ffdc[type].regs = kmalloc(e * sizeof(struct genwqe_reg), | 391 | cd->ffdc[type].regs = |
387 | GFP_KERNEL); | 392 | kmalloc_array(e, sizeof(struct genwqe_reg), |
393 | GFP_KERNEL); | ||
388 | /* | 394 | /* |
389 | * regs == NULL is ok, the using code treats this as no regs, | 395 | * regs == NULL is ok, the using code treats this as no regs, |
390 | * Printing warning is ok in this case. | 396 | * Printing warning is ok in this case. |
@@ -723,8 +729,8 @@ static u64 genwqe_fir_checking(struct genwqe_dev *cd) | |||
723 | __genwqe_writeq(cd, sfir_addr, sfir); | 729 | __genwqe_writeq(cd, sfir_addr, sfir); |
724 | 730 | ||
725 | dev_dbg(&pci_dev->dev, | 731 | dev_dbg(&pci_dev->dev, |
726 | "[HM] Clearing 2ndary FIR 0x%08x " | 732 | "[HM] Clearing 2ndary FIR 0x%08x with 0x%016llx\n", |
727 | "with 0x%016llx\n", sfir_addr, sfir); | 733 | sfir_addr, sfir); |
728 | 734 | ||
729 | /* | 735 | /* |
730 | * note, these cannot be error-Firs | 736 | * note, these cannot be error-Firs |
@@ -740,9 +746,8 @@ static u64 genwqe_fir_checking(struct genwqe_dev *cd) | |||
740 | __genwqe_writeq(cd, fir_clr_addr, mask); | 746 | __genwqe_writeq(cd, fir_clr_addr, mask); |
741 | 747 | ||
742 | dev_dbg(&pci_dev->dev, | 748 | dev_dbg(&pci_dev->dev, |
743 | "[HM] Clearing primary FIR 0x%08x " | 749 | "[HM] Clearing primary FIR 0x%08x with 0x%016llx\n", |
744 | "with 0x%016llx\n", fir_clr_addr, | 750 | fir_clr_addr, mask); |
745 | mask); | ||
746 | } | 751 | } |
747 | } | 752 | } |
748 | } | 753 | } |
@@ -1125,6 +1130,8 @@ static int genwqe_pci_setup(struct genwqe_dev *cd) | |||
1125 | } | 1130 | } |
1126 | 1131 | ||
1127 | cd->num_vfs = pci_sriov_get_totalvfs(pci_dev); | 1132 | cd->num_vfs = pci_sriov_get_totalvfs(pci_dev); |
1133 | if (cd->num_vfs < 0) | ||
1134 | cd->num_vfs = 0; | ||
1128 | 1135 | ||
1129 | err = genwqe_read_ids(cd); | 1136 | err = genwqe_read_ids(cd); |
1130 | if (err) | 1137 | if (err) |
@@ -1202,8 +1209,8 @@ static int genwqe_probe(struct pci_dev *pci_dev, | |||
1202 | err = genwqe_health_check_start(cd); | 1209 | err = genwqe_health_check_start(cd); |
1203 | if (err < 0) { | 1210 | if (err < 0) { |
1204 | dev_err(&pci_dev->dev, | 1211 | dev_err(&pci_dev->dev, |
1205 | "err: cannot start health checking! " | 1212 | "err: cannot start health checking! (err=%d)\n", |
1206 | "(err=%d)\n", err); | 1213 | err); |
1207 | goto out_stop_services; | 1214 | goto out_stop_services; |
1208 | } | 1215 | } |
1209 | } | 1216 | } |
@@ -1313,11 +1320,14 @@ static void genwqe_err_resume(struct pci_dev *pci_dev) | |||
1313 | 1320 | ||
1314 | static int genwqe_sriov_configure(struct pci_dev *dev, int numvfs) | 1321 | static int genwqe_sriov_configure(struct pci_dev *dev, int numvfs) |
1315 | { | 1322 | { |
1323 | int rc; | ||
1316 | struct genwqe_dev *cd = dev_get_drvdata(&dev->dev); | 1324 | struct genwqe_dev *cd = dev_get_drvdata(&dev->dev); |
1317 | 1325 | ||
1318 | if (numvfs > 0) { | 1326 | if (numvfs > 0) { |
1319 | genwqe_setup_vf_jtimer(cd); | 1327 | genwqe_setup_vf_jtimer(cd); |
1320 | pci_enable_sriov(dev, numvfs); | 1328 | rc = pci_enable_sriov(dev, numvfs); |
1329 | if (rc < 0) | ||
1330 | return rc; | ||
1321 | return numvfs; | 1331 | return numvfs; |
1322 | } | 1332 | } |
1323 | if (numvfs == 0) { | 1333 | if (numvfs == 0) { |