diff mbox series

hwrng: cavium: fix NULL but dereferenced coccicheck error

Message ID 20220225063901.893274-1-wanjiabing@vivo.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series hwrng: cavium: fix NULL but dereferenced coccicheck error | expand

Commit Message

Jiabing Wan Feb. 25, 2022, 6:38 a.m. UTC
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 <wanjiabing@vivo.com>
---
 drivers/char/hw_random/cavium-rng-vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sunil Kovvuri Goutham Feb. 26, 2022, 8:16 a.m. UTC | #1
> -----Original Message-----
> From: Wan Jiabing <wanjiabing@vivo.com>
> Sent: Friday, February 25, 2022 12:09 PM
> To: Matt Mackall <mpm@selenic.com>; Herbert Xu
> <herbert@gondor.apana.org.au>; Sunil Kovvuri Goutham
> <sgoutham@marvell.com>; Wan Jiabing <wanjiabing@vivo.com>; linux-
> crypto@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: jiabing.wan@qq.com
> 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 <wanjiabing@vivo.com>
> ---
>  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 <sgoutham@marvell.com>
Herbert Xu March 2, 2022, 10:59 p.m. UTC | #2
On Fri, Feb 25, 2022 at 02:38:59PM +0800, Wan Jiabing wrote:
> 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 <wanjiabing@vivo.com>
> ---
>  drivers/char/hw_random/cavium-rng-vf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
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 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;
 	}