Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support

From: Can Guo
Date: Thu Mar 04 2021 - 03:39:10 EST


On 2021-03-03 22:50, Bean Huo wrote:
On Wed, 2021-03-03 at 15:29 +0900, Daejun Park wrote:
+
+static inline void ufshpb_put_pre_req(struct ufshpb_lu *hpb,
+ struct ufshpb_req *pre_req)
+{
+ pre_req->req = NULL;
+ pre_req->bio = NULL;
+ list_add_tail(&pre_req->list_req, &hpb->lh_pre_req_free);
+ hpb->num_inflight_pre_req--;
+}
+
+static void ufshpb_pre_req_compl_fn(struct request *req,
blk_status_t error)
+{
+ struct ufshpb_req *pre_req = (struct ufshpb_req *)req-
>end_io_data;
+ struct ufshpb_lu *hpb = pre_req->hpb;
+ unsigned long flags;
+ struct scsi_sense_hdr sshdr;
+
+ if (error) {
+ dev_err(&hpb->sdev_ufs_lu->sdev_dev, "block status
%d", error);
+ scsi_normalize_sense(pre_req->sense,
SCSI_SENSE_BUFFERSIZE,
+ &sshdr);
+ dev_err(&hpb->sdev_ufs_lu->sdev_dev,
+ "code %x sense_key %x asc %x ascq %x",
+ sshdr.response_code,
+ sshdr.sense_key, sshdr.asc, sshdr.ascq);
+ dev_err(&hpb->sdev_ufs_lu->sdev_dev,
+ "byte4 %x byte5 %x byte6 %x additional_len
%x",
+ sshdr.byte4, sshdr.byte5,
+ sshdr.byte6, sshdr.additional_length);
+ }


How can you print out sense_key and sense code here? sense code will
not be copied to pre_req->sense. you should directly use
scsi_request->sense or let pre_req->sense point to scsi_request->sense.

You update the new version patch so quickly. In another word, I am
wondering if you tested your patch before submitting?

Bean

Bean is right about the sense buffer...