On 05/07/2015 01:41 PM, Bart Van Assche wrote: > On 05/04/15 14:42, Hannes Reinecke wrote: >> -/* >> * submit_rtpg - Issue a REPORT TARGET GROUP STATES command >> * @sdev: sdev the command should be sent to >> */ >> @@ -352,55 +315,42 @@ static int alua_check_tpgs(struct >> scsi_device *sdev, struct alua_dh_data *h) >> sdev_printk(KERN_INFO, sdev, "%s: supports implicit >> TPGS\n", >> ALUA_DH_NAME); >> break; >> - default: >> - h->tpgs = TPGS_MODE_NONE; >> + case TPGS_MODE_NONE: >> sdev_printk(KERN_INFO, sdev, "%s: not supported\n", >> ALUA_DH_NAME); >> err = SCSI_DH_DEV_UNSUPP; >> break; >> + default: >> + sdev_printk(KERN_INFO, sdev, >> + "%s: unsupported TPGS setting %d\n", >> + ALUA_DH_NAME, h->tpgs); >> + h->tpgs = TPGS_MODE_NONE; >> + err = SCSI_DH_DEV_UNSUPP; >> + break; >> } >> >> return err; >> } > > The function scsi_device_tpgs() returns a value between 0 and 3. So > why to add a fifth case in this switch statement ? > Because I'm paranoid? 'h->tpgs' is an integer, so _in principle_ it could take any value. We can only safely restrict this by turning 'h->tpgs' into an enum. _And_ 'h->tpgs' is being set to '-1' initially, so this is to catch any logic / initialisation issues. Cheers, Hannes -- Dr. Hannes Reinecke zSeries & Storage hare@xxxxxxx +49 911 74053 688 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG Nürnberg) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html