diff mbox series

hwrng: cavium: fix possible NULL pointer dereference

Message ID 1647573872-19278-1-git-send-email-baihaowen@meizu.com
State New
Headers show
Series hwrng: cavium: fix possible NULL pointer dereference | expand

Commit Message

baihaowen March 18, 2022, 3:24 a.m. UTC
pdev is NULL but dereference to pdev->dev

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 drivers/char/hw_random/cavium-rng-vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/char/hw_random/cavium-rng-vf.c b/drivers/char/hw_random/cavium-rng-vf.c
index 6f66919..bffcb01 100644
--- a/drivers/char/hw_random/cavium-rng-vf.c
+++ b/drivers/char/hw_random/cavium-rng-vf.c
@@ -179,7 +179,7 @@  static int cavium_map_pf_regs(struct cavium_rng *rng)
 	pdev = pci_get_device(PCI_VENDOR_ID_CAVIUM,
 			      PCI_DEVID_CAVIUM_RNG_PF, NULL);
 	if (!pdev) {
-		dev_err(&pdev->dev, "Cannot find RNG PF device\n");
+		printk(KERN_ERR "Cannot find RNG PF device\n");
 		return -EIO;
 	}