On 2020-04-30 06:18, Hannes Reinecke wrote: > +/** > + * scsi_get_reserved_cmd - allocate a SCSI command from reserved tags > + * @sdev: SCSI device from which to allocate the command > + * @data_direction: Data direction for the allocated command > + */ > +struct scsi_cmnd *scsi_get_reserved_cmd(struct scsi_device *sdev, > + int data_direction) > +{ > + struct request *rq; > + struct scsi_cmnd *scmd; > + > + rq = blk_mq_alloc_request(sdev->request_queue, > + data_direction == DMA_TO_DEVICE ? > + REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN | REQ_NOWAIT, > + BLK_MQ_REQ_RESERVED); > + if (IS_ERR(rq)) > + return NULL; > + scmd = blk_mq_rq_to_pdu(rq); > + scmd->request = rq; > + return scmd; > +} Isn't REQ_NOWAIT something the caller should decide about instead of always setting that flag? Additionally, I think some parentheses are missing. I think the compiler will interpret the blk_mq_alloc_request() call as follows, which is probably not what was intended: rq = blk_mq_alloc_request(sdev->request_queue, data_direction == DMA_TO_DEVICE ? REQ_OP_SCSI_OUT : (REQ_OP_SCSI_IN | REQ_NOWAIT), BLK_MQ_REQ_RESERVED); Thanks, Bart.