linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Don Brace <don.brace@pmcs.com>,
	scott.teel@pmcs.com, Kevin.Barnett@pmcs.com,
	scott.benesh@pmcs.com, james.bottomley@parallels.com,
	hch@infradead.org, Justin.Lindley@pmcs.com, elliott@hpe.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 1 04/25] hpsa: fix null device issues
Date: Fri, 30 Oct 2015 08:49:28 +0100	[thread overview]
Message-ID: <56332108.3020907@suse.de> (raw)
In-Reply-To: <20151028220453.5323.34762.stgit@brunhilda>

On 10/28/2015 11:04 PM, Don Brace wrote:
> Signed-off-by: Don Brace <don.brace@pmcs.com>
> ---
>  drivers/scsi/hpsa.c |   25 ++++++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 6b6e9bb..3fe8a18 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -1136,7 +1136,7 @@ static int hpsa_find_target_lun(struct ctlr_info *h,
>  	return !found;
>  }
>  
> -static inline void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
> +static void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
>  	struct hpsa_scsi_dev_t *dev, char *description)
>  {
>  	if (dev == NULL)
This is not a null device check; you modified the function.
Please put it into a separate function.

Or make a patch 'cleanup' or something.

> @@ -1423,6 +1423,9 @@ static int hpsa_scsi_find_entry(struct hpsa_scsi_dev_t *needle,
>  #define DEVICE_CHANGED 1
>  #define DEVICE_SAME 2
>  #define DEVICE_UPDATED 3
> +	if (needle == NULL)
> +		return DEVICE_NOT_FOUND;
> +
>  	for (i = 0; i < haystack_size; i++) {
>  		if (haystack[i] == NULL) /* previously removed. */
>  			continue;
> @@ -1574,6 +1577,9 @@ static void hpsa_figure_phys_disk_ptrs(struct ctlr_info *h,
>  				total_disks_per_row;
>  	int qdepth;
>  
> +	if (logical_drive == NULL)
> +		return;
> +
>  	if (nraid_map_entries > RAID_MAP_MAX_ENTRIES)
>  		nraid_map_entries = RAID_MAP_MAX_ENTRIES;
>  
> @@ -1585,6 +1591,8 @@ static void hpsa_figure_phys_disk_ptrs(struct ctlr_info *h,
>  		if (!logical_drive->offload_config)
>  			continue;
>  		for (j = 0; j < ndevices; j++) {
> +			if (dev[j] == NULL)
> +				continue;
>  			if (dev[j]->devtype != TYPE_DISK)
>  				continue;
>  			if (is_logical_dev_addr_mode(dev[j]->scsi3addr))
> @@ -1628,6 +1636,8 @@ static void hpsa_update_log_drive_phys_drive_ptrs(struct ctlr_info *h,
>  	int i;
>  
>  	for (i = 0; i < ndevices; i++) {
> +		if (dev[i] == NULL)
> +			continue;
>  		if (dev[i]->devtype != TYPE_DISK)
>  			continue;
>  		if (!is_logical_dev_addr_mode(dev[i]->scsi3addr))
> @@ -1743,8 +1753,11 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
>  	/* Now that h->dev[]->phys_disk[] is coherent, we can enable
>  	 * any logical drives that need it enabled.
>  	 */
> -	for (i = 0; i < h->ndevices; i++)
> +	for (i = 0; i < h->ndevices; i++) {
> +		if (h->dev[i] == NULL)
> +			continue;
>  		h->dev[i]->offload_enabled = h->dev[i]->offload_to_be_enabled;
> +	}
>  
>  	spin_unlock_irqrestore(&h->devlock, flags);
>  
> @@ -1769,6 +1782,8 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
>  	sh = h->scsi_host;
>  	/* Notify scsi mid layer of any removed devices */
>  	for (i = 0; i < nremoved; i++) {
> +		if (removed[i] == NULL)
> +			continue;
>  		if (removed[i]->expose_state & HPSA_SCSI_ADD) {
>  			struct scsi_device *sdev =
>  				scsi_device_lookup(sh, removed[i]->bus,
> @@ -1792,18 +1807,18 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, int hostno,
>  
>  	/* Notify scsi mid layer of any added devices */
>  	for (i = 0; i < nadded; i++) {
> +		if (added[i] == NULL)
> +			continue;
>  		if (!(added[i]->expose_state & HPSA_SCSI_ADD))
>  			continue;
>  		if (scsi_add_device(sh, added[i]->bus,
>  			added[i]->target, added[i]->lun) == 0)
>  			continue;
> -		hpsa_show_dev_msg(KERN_WARNING, h, added[i],
> -					"addition failed, device not added.");
> +		dev_warn(&h->pdev->dev, "addition failed, device not added.");
>  		/* now we have to remove it from h->dev,
>  		 * since it didn't get added to scsi mid layer
>  		 */
>  		fixup_botched_add(h, added[i]);
> -		added[i] = NULL;
>  	}
>  
>  free_and_out:
> 
Again, modifying the logging message is not a null device check.
Please move it into another patch.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-10-30  7:49 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28 22:04 [PATCH 1 00/25] hpsa updates Don Brace
2015-10-28 22:04 ` [PATCH 1 01/25] hpsa: stop zeroing reset_cmds_out and ioaccel_cmds_out during rescan Don Brace
2015-10-29 13:25   ` Tomas Henzl
2015-10-30  7:45   ` Hannes Reinecke
2015-10-28 22:04 ` [PATCH 1 02/25] hpsa: remove unused hpsa_tag_discard_error_bits Don Brace
2015-10-29 13:26   ` Tomas Henzl
2015-10-29 14:37   ` Manoj Kumar
2015-10-29 14:49     ` Don Brace
2015-10-30  7:46   ` Hannes Reinecke
2015-10-28 22:04 ` [PATCH 1 03/25] hpsa: check for null arguments to dev_printk Don Brace
2015-10-29 13:41   ` Tomas Henzl
2015-10-29 14:41   ` Manoj Kumar
2015-10-30  7:47   ` Hannes Reinecke
2015-10-30 14:16     ` Don Brace
2015-10-28 22:04 ` [PATCH 1 04/25] hpsa: fix null device issues Don Brace
2015-10-29 14:06   ` Tomas Henzl
2015-10-30  7:49   ` Hannes Reinecke [this message]
2015-10-28 22:05 ` [PATCH 1 05/25] hpsa: allow driver requested rescans Don Brace
2015-10-30  7:51   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 06/25] hpsa: abandon rescans on memory alloaction failures Don Brace
2015-10-30  7:53   ` Hannes Reinecke
2015-10-30 20:44     ` Don Brace
2015-10-28 22:05 ` [PATCH 1 07/25] hpsa: correct transfer length for 6 byte read/write commands Don Brace
2015-10-30  7:54   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 08/25] hpsa: fix hpsa_adjust_hpsa_scsi_table Don Brace
2015-10-29 14:23   ` Tomas Henzl
2015-10-30  7:57   ` Hannes Reinecke
2015-10-30 20:46     ` Don Brace
2015-10-28 22:05 ` [PATCH 1 09/25] hpsa: fix physical target reset Don Brace
2015-10-29 14:30   ` Tomas Henzl
2015-10-29 15:29     ` Don Brace
2015-10-29 15:52       ` Tomas Henzl
2015-10-30  7:59   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 10/25] hpsa: correct check for non-disk devices Don Brace
2015-10-29 14:37   ` Tomas Henzl
2015-10-30  8:01   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 11/25] hpsa: correct ioaccel2 sg chain len Don Brace
2015-10-29 15:01   ` Tomas Henzl
2015-10-30  8:01   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 12/25] hpsa: simplify check for device exposure Don Brace
2015-10-29 15:03   ` Tomas Henzl
2015-10-30  8:04   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 13/25] hpsa: simplify update scsi devices Don Brace
2015-10-29 15:53   ` Tomas Henzl
2015-10-29 16:43   ` Matthew R. Ochs
2015-10-29 19:01     ` Don Brace
2015-10-29 20:28       ` Matthew R. Ochs
2015-10-30  8:05   ` Hannes Reinecke
2015-10-28 22:05 ` [PATCH 1 14/25] hpsa: add function is_logical_device Don Brace
2015-10-29 15:53   ` Tomas Henzl
2015-10-29 16:46   ` Matthew R. Ochs
2015-10-30  8:05   ` Hannes Reinecke
2015-10-28 22:06 ` [PATCH 1 15/25] hpsa: enhance hpsa_get_device_id Don Brace
2015-10-29 16:04   ` Tomas Henzl
2015-10-29 17:04   ` Matthew R. Ochs
2015-10-30  8:08   ` Hannes Reinecke
2015-10-30 20:59     ` Don Brace
2015-10-28 22:06 ` [PATCH 1 16/25] hpsa: refactor hpsa_figure_bus_target_lun Don Brace
2015-10-29 16:27   ` Tomas Henzl
2015-10-30  8:09   ` Hannes Reinecke
2015-10-28 22:06 ` [PATCH 1 17/25] hpsa: move scsi_add_device and scsi_remove_device calls to new function Don Brace
2015-10-29 16:37   ` Tomas Henzl
2015-10-29 17:21   ` Matthew R. Ochs
2015-10-29 20:30     ` Don Brace
2015-10-30 15:56       ` Matthew R. Ochs
2015-10-30  8:09   ` Hannes Reinecke
2015-10-28 22:06 ` [PATCH 1 18/25] External array LUNs must use target and lun numbers assigned by the Don Brace
2015-10-29 19:41   ` Matthew R. Ochs
2015-10-30  8:11   ` Hannes Reinecke
2015-10-30 14:11   ` Tomas Henzl
2015-10-28 22:06 ` [PATCH 1 19/25] hpsa: eliminate fake lun0 enclosures Don Brace
2015-10-29 20:05   ` Matthew R. Ochs
2015-10-30  8:12   ` Hannes Reinecke
2015-10-30 14:12   ` Tomas Henzl
2015-10-28 22:06 ` [PATCH 1 20/25] hpsa: add discovery polling for PT RAID devices Don Brace
2015-10-29 20:20   ` Matthew R. Ochs
     [not found]     ` <563286B7.8070200@pmcs.com>
2015-10-29 20:59       ` Matthew R. Ochs
2015-10-30 14:08         ` Don Brace
2015-10-30 15:58           ` Matthew R. Ochs
2015-10-30  8:15   ` Hannes Reinecke
2015-10-28 22:06 ` [PATCH 1 21/25] hpsa: disable report lun data caching Don Brace
2015-10-30  8:16   ` Hannes Reinecke
2015-10-30 14:25   ` Tomas Henzl
2015-10-30 21:18     ` Don Brace
2015-10-30 16:27   ` Matthew R. Ochs
2015-10-28 22:06 ` [PATCH 1 22/25] hpsa: enhance device messages Don Brace
2015-10-30  8:16   ` Hannes Reinecke
2015-10-30 14:32   ` Tomas Henzl
2015-11-02 16:54     ` Don Brace
2015-11-03 13:12       ` Tomas Henzl
2015-10-30 16:53   ` Matthew R. Ochs
2015-10-28 22:06 ` [PATCH 1 23/25] hpsa: fix multiple issues in path_info_show Don Brace
2015-10-30  8:18   ` Hannes Reinecke
2015-10-30 14:33   ` Tomas Henzl
2015-10-30 17:07   ` Matthew R. Ochs
2015-10-28 22:06 ` [PATCH 1 24/25] hpsa: add in sas transport class Don Brace
2015-10-30  8:21   ` Hannes Reinecke
2015-10-30 14:40   ` Tomas Henzl
2015-10-30 20:07   ` Matthew R. Ochs
2015-10-30 22:00     ` Don Brace
2015-10-30 23:23       ` Matthew R. Ochs
2015-11-03  0:40   ` kbuild test robot
2015-10-28 22:07 ` [PATCH 1 25/25] hpsa: bump the driver version Don Brace
2015-10-30  8:22   ` Hannes Reinecke
2015-10-30 14:44   ` Tomas Henzl
2015-10-30 20:08   ` Matthew R. Ochs
2015-11-03  4:49 ` [PATCH 1 00/25] hpsa updates Martin K. Petersen

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=56332108.3020907@suse.de \
    --to=hare@suse.de \
    --cc=Justin.Lindley@pmcs.com \
    --cc=Kevin.Barnett@pmcs.com \
    --cc=don.brace@pmcs.com \
    --cc=elliott@hpe.com \
    --cc=hch@infradead.org \
    --cc=james.bottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=scott.benesh@pmcs.com \
    --cc=scott.teel@pmcs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).