diff mbox series

[2/9] media: cx18: use GFP_KERNEL

Message ID 20220210204223.104181-3-Julia.Lawall@inria.fr (mailing list archive)
State New, archived
Headers show
Series use GFP_KERNEL | expand

Commit Message

Julia Lawall Feb. 10, 2022, 8:42 p.m. UTC
Pci_driver probe functions aren't called with locks held
and thus don't need GFP_ATOMIC. Use GFP_KERNEL instead.

Problem found with Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 drivers/media/pci/cx18/cx18-driver.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dan Carpenter Feb. 18, 2022, 12:26 p.m. UTC | #1
On Thu, Feb 10, 2022 at 09:42:16PM +0100, Julia Lawall wrote:
> Pci_driver probe functions aren't called with locks held
> and thus don't need GFP_ATOMIC. Use GFP_KERNEL instead.
> 
> Problem found with Coccinelle.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
> 
> ---
>  drivers/media/pci/cx18/cx18-driver.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
> index 59497ba6bf1f..1be9672ae9d4 100644
> --- a/drivers/media/pci/cx18/cx18-driver.c
> +++ b/drivers/media/pci/cx18/cx18-driver.c
> @@ -899,7 +899,7 @@ static int cx18_probe(struct pci_dev *pci_dev,
>  		return -ENOMEM;

Unrelated to your patch but every error path in this function ought to
call atomic_dec(&cx18_instance);

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
index 59497ba6bf1f..1be9672ae9d4 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -899,7 +899,7 @@  static int cx18_probe(struct pci_dev *pci_dev,
 		return -ENOMEM;
 	}
 
-	cx = kzalloc(sizeof(*cx), GFP_ATOMIC);
+	cx = kzalloc(sizeof(*cx), GFP_KERNEL);
 	if (!cx)
 		return -ENOMEM;