From: Mike Qiu <qiudayu@linux.vnet.ibm.com>
To: Tejun Heo <tj@kernel.org>
Cc: Jesse Brandeburg <jesse.brandeburg@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-ide@vger.kernel.org, wenxiong@linux.vnet.ibm.com,
brking@linux.vnet.ibm.com, zhenghch@cn.ibm.com,
haokexin@gmail.com
Subject: Re: [PATCH 2/2] libata: Fix NULL pointer of scsi_host in ata_port
Date: Wed, 23 Jul 2014 10:29:22 +0800 [thread overview]
Message-ID: <53CF1E02.4000602@linux.vnet.ibm.com> (raw)
In-Reply-To: <20140722201109.GN13851@htj.dyndns.org>
I have tested with the ipr IOA, passed.
Reviewed-and Tested-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
On 07/23/2014 04:11 AM, Tejun Heo wrote:
> Hello,
>
> Can you please test the following patch?
>
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index d19c37a7..773f4e6 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -4798,9 +4798,8 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
> static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap)
> {
> struct ata_queued_cmd *qc = NULL;
> - unsigned int i, tag, max_queue;
> -
> - max_queue = ap->scsi_host->can_queue;
> + unsigned int max_queue = ap->host->n_tags;
> + unsigned int i, tag;
>
> /* no command while frozen */
> if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
> @@ -6094,6 +6093,7 @@ void ata_host_init(struct ata_host *host, struct device *dev,
> {
> spin_lock_init(&host->lock);
> mutex_init(&host->eh_mutex);
> + host->n_tags = ATA_MAX_QUEUE;
> host->dev = dev;
> host->ops = ops;
> }
> @@ -6179,11 +6179,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
> * The max queue supported by hardware must not be greater than
> * ATA_MAX_QUEUE.
> */
> - if (sht->can_queue > ATA_MAX_QUEUE) {
> - dev_err(host->dev, "BUG: the hardware max queue is too large\n");
> - WARN_ON(1);
> - return -EINVAL;
> - }
> + host->n_tags = clamp(sht->can_queue, 1, ATA_MAX_QUEUE);
>
> /* host must have been started */
> if (!(host->flags & ATA_HOST_STARTED)) {
> diff --git a/include/linux/libata.h b/include/linux/libata.h
> index 5ab4e3a..92abb49 100644
> --- a/include/linux/libata.h
> +++ b/include/linux/libata.h
> @@ -593,6 +593,7 @@ struct ata_host {
> struct device *dev;
> void __iomem * const *iomap;
> unsigned int n_ports;
> + unsigned int n_tags; /* nr of NCQ tags */
> void *private_data;
> struct ata_port_operations *ops;
> unsigned long flags;
>
next prev parent reply other threads:[~2014-07-23 2:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-22 14:51 [PATCH 2/2] libata: Fix NULL pointer of scsi_host in ata_port Mike Qiu
2014-07-22 14:58 ` Mike Qiu
[not found] ` <CAEuXFExJAq5hpYe8R_De7hOtGN1Jrx6HCQt0tQBAKnDTKEpaBA@mail.gmail.com>
2014-07-22 20:11 ` Tejun Heo
2014-07-23 2:29 ` Mike Qiu [this message]
2014-07-23 9:03 ` Alexey Kardashevskiy
2014-07-24 22:29 ` Jesse Brandeburg
2014-07-23 14:46 ` [PATCH libata/for-3.16-fixes] libata: introduce ata_host->n_tags to avoid oops on SAS controllers Tejun Heo
2014-07-23 16:31 ` Bartlomiej Zolnierkiewicz
2014-07-23 16:36 ` Tejun Heo
2014-07-23 16:46 ` Bartlomiej Zolnierkiewicz
2014-07-23 17:20 ` Tejun Heo
2014-07-22 19:47 ` [PATCH 2/2] libata: Fix NULL pointer of scsi_host in ata_port Peter Hurley
2014-07-23 2:37 ` Mike Qiu
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=53CF1E02.4000602@linux.vnet.ibm.com \
--to=qiudayu@linux.vnet.ibm.com \
--cc=brking@linux.vnet.ibm.com \
--cc=haokexin@gmail.com \
--cc=jesse.brandeburg@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=wenxiong@linux.vnet.ibm.com \
--cc=zhenghch@cn.ibm.com \
/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.