All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: "James E.J. Bottomley" <James.Bottomley@suse.de>
Cc: Jiri Kosina <jkosina@suse.cz>, Daniel Mack <daniel@caiaq.de>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] scsi/initio: add GFP_KERNEL flag
Date: Sat, 17 Jul 2010 10:24:32 +0000	[thread overview]
Message-ID: <20100717102432.GD17585@bicker> (raw)

Calling scb = kzalloc(i, GFP_DMA) is not the right idea.  If this is
what we really wanted it would be better to specify it explicitly as 
kzalloc(i, GFP_NOWAIT | GFP_DMA).  But in this case it's OK to wait so
I changed it to use GFP_KERNEL.  Also I added a __GFP_NOWARN, since we
expect the allocation to fail occasionaly (and we just try allocate a 
smaller amount on the next time through the loop).

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index a771416..a4baa44 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2885,7 +2885,8 @@ static int initio_probe_one(struct pci_dev *pdev,
 
 	for (; num_scb >= MAX_TARGETS + 3; num_scb--) {
 		i = num_scb * sizeof(struct scsi_ctrl_blk);
-		if ((scb = kzalloc(i, GFP_DMA)) != NULL)
+		scb = kzalloc(i, GFP_KERNEL | GFP_DMA | __GFP_NOWARN);
+		if (scb)
 			break;
 	}
 

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: "James E.J. Bottomley" <James.Bottomley@suse.de>
Cc: Jiri Kosina <jkosina@suse.cz>, Daniel Mack <daniel@caiaq.de>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] scsi/initio: add GFP_KERNEL flag
Date: Sat, 17 Jul 2010 12:24:32 +0200	[thread overview]
Message-ID: <20100717102432.GD17585@bicker> (raw)

Calling scb = kzalloc(i, GFP_DMA) is not the right idea.  If this is
what we really wanted it would be better to specify it explicitly as 
kzalloc(i, GFP_NOWAIT | GFP_DMA).  But in this case it's OK to wait so
I changed it to use GFP_KERNEL.  Also I added a __GFP_NOWARN, since we
expect the allocation to fail occasionaly (and we just try allocate a 
smaller amount on the next time through the loop).

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index a771416..a4baa44 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2885,7 +2885,8 @@ static int initio_probe_one(struct pci_dev *pdev,
 
 	for (; num_scb >= MAX_TARGETS + 3; num_scb--) {
 		i = num_scb * sizeof(struct scsi_ctrl_blk);
-		if ((scb = kzalloc(i, GFP_DMA)) != NULL)
+		scb = kzalloc(i, GFP_KERNEL | GFP_DMA | __GFP_NOWARN);
+		if (scb)
 			break;
 	}
 

             reply	other threads:[~2010-07-17 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-17 10:24 Dan Carpenter [this message]
2010-07-17 10:24 ` [patch] scsi/initio: add GFP_KERNEL flag Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100717102432.GD17585@bicker \
    --to=error27@gmail.com \
    --cc=James.Bottomley@suse.de \
    --cc=daniel@caiaq.de \
    --cc=jkosina@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.