Skip to content

Commit 1b76198

Browse files
GustavoARSilvajonmason
authored andcommitted
NTB: ntb_hw_idt: replace IS_ERR_OR_NULL with regular NULL checks
Both devm_kcalloc() and devm_kzalloc() return NULL on error. They never return error pointers. The use of IS_ERR_OR_NULL is currently applied to the wrong context. Fix this by replacing IS_ERR_OR_NULL with regular NULL checks. Fixes: bf2a952 ("NTB: Add IDT 89HPESxNTx PCIe-switches support") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
1 parent 7756e2b commit 1b76198

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/ntb/hw/idt/ntb_hw_idt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,9 +1105,9 @@ static struct idt_mw_cfg *idt_scan_mws(struct idt_ntb_dev *ndev, int port,
11051105
}
11061106

11071107
/* Allocate memory for memory window descriptors */
1108-
ret_mws = devm_kcalloc(&ndev->ntb.pdev->dev, *mw_cnt,
1109-
sizeof(*ret_mws), GFP_KERNEL);
1110-
if (IS_ERR_OR_NULL(ret_mws))
1108+
ret_mws = devm_kcalloc(&ndev->ntb.pdev->dev, *mw_cnt, sizeof(*ret_mws),
1109+
GFP_KERNEL);
1110+
if (!ret_mws)
11111111
return ERR_PTR(-ENOMEM);
11121112

11131113
/* Copy the info of detected memory windows */
@@ -2390,7 +2390,7 @@ static struct idt_ntb_dev *idt_create_dev(struct pci_dev *pdev,
23902390

23912391
/* Allocate memory for the IDT PCIe-device descriptor */
23922392
ndev = devm_kzalloc(&pdev->dev, sizeof(*ndev), GFP_KERNEL);
2393-
if (IS_ERR_OR_NULL(ndev)) {
2393+
if (!ndev) {
23942394
dev_err(&pdev->dev, "Memory allocation failed for descriptor");
23952395
return ERR_PTR(-ENOMEM);
23962396
}

0 commit comments

Comments
 (0)