2022-02-25 09:53:14

by Jiabing Wan

[permalink] [raw]
Subject: [PATCH] hwrng: cavium: fix NULL but dereferenced coccicheck error

Fix following coccicheck warning:
./drivers/char/hw_random/cavium-rng-vf.c:182:17-20: ERROR:
pdev is NULL but dereferenced.

Signed-off-by: Wan Jiabing <[email protected]>
---
drivers/char/hw_random/cavium-rng-vf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/cavium-rng-vf.c b/drivers/char/hw_random/cavium-rng-vf.c
index 6f66919652bf..7c55f4cf4a8b 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");
+ pr_err("Cannot find RNG PF device\n");
return -EIO;
}

--
2.35.1


2022-02-26 10:50:39

by Sunil Kovvuri Goutham

[permalink] [raw]
Subject: RE: [EXT] [PATCH] hwrng: cavium: fix NULL but dereferenced coccicheck error



> -----Original Message-----
> From: Wan Jiabing <[email protected]>
> Sent: Friday, February 25, 2022 12:09 PM
> To: Matt Mackall <[email protected]>; Herbert Xu
> <[email protected]>; Sunil Kovvuri Goutham
> <[email protected]>; Wan Jiabing <[email protected]>; linux-
> [email protected]; [email protected]
> Cc: [email protected]
> Subject: [EXT] [PATCH] hwrng: cavium: fix NULL but dereferenced coccicheck
> error
>
> External Email
>
> ----------------------------------------------------------------------
> Fix following coccicheck warning:
> ./drivers/char/hw_random/cavium-rng-vf.c:182:17-20: ERROR:
> pdev is NULL but dereferenced.
>
> Signed-off-by: Wan Jiabing <[email protected]>
> ---
> drivers/char/hw_random/cavium-rng-vf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/hw_random/cavium-rng-vf.c
> b/drivers/char/hw_random/cavium-rng-vf.c
> index 6f66919652bf..7c55f4cf4a8b 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");
> + pr_err("Cannot find RNG PF device\n");
> return -EIO;
> }
>
> --

Thanks for the fix.
Reviewed-by: Sunil Goutham <[email protected]>