public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-ide@vger.kernel.org, Niklas Cassel <cassel@kernel.org>
Subject: Re: [PATCH 3/6] ata: libata-scsi: Refactor ata_scsiop_maint_in()
Date: Fri, 20 Mar 2026 12:08:22 +0900	[thread overview]
Message-ID: <ae9f75cc-23c2-45bc-aaa3-0746ed70e37e@kernel.org> (raw)
In-Reply-To: <0676888d-e683-4696-8289-ee8bf43beeb0@roeck-us.net>

On 3/20/26 11:13, Guenter Roeck wrote:
> Hi,
> 
> On Tue, Oct 22, 2024 at 11:45:34AM +0900, Damien Le Moal wrote:
>> Move the check for MI_REPORT_SUPPORTED_OPERATION_CODES from
>> ata_scsi_simulate() into ata_scsiop_maint_in() to simplify
>> ata_scsi_simulate() code.
>>
>> Furthermore, since an rbuff fill actor function returning a non-zero
>> value causes no data to be returned for the command, directly return
>> an error (return 1) for invalid command formt after setting the invalid
>> field in cdb error.
>>
>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>> ---
>>  drivers/ata/libata-scsi.c | 20 +++++++++++---------
>>  1 file changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
>> index 8097cf318b04..f9c70f650cfc 100644
>> --- a/drivers/ata/libata-scsi.c
>> +++ b/drivers/ata/libata-scsi.c
>> @@ -3388,12 +3388,16 @@ static unsigned int ata_scsiop_maint_in(struct ata_scsi_args *args, u8 *rbuf)
>>  	struct ata_device *dev = args->dev;
>>  	u8 *cdb = args->cmd->cmnd;
>>  	u8 supported = 0, cdlp = 0, rwcdlp = 0;
>> -	unsigned int err = 0;
>> +
>> +	if ((cdb[1] & 0x1f) != MI_REPORT_SUPPORTED_OPERATION_CODES) {
>> +		ata_scsi_set_invalid_field(dev, args->cmd, 1, 0xff);
>> +		return 1;
>> +	}
>>  
>>  	if (cdb[2] != 1 && cdb[2] != 3) {
>>  		ata_dev_warn(dev, "invalid command format %d\n", cdb[2]);
>> -		err = 2;
>> -		goto out;
>> +		ata_scsi_set_invalid_field(dev, args->cmd, 1, 0xff);
> 
> Nit, but should this possibly be
> 		ata_scsi_set_invalid_field(dev, args->cmd, 2, 0xff);
> 							   ^
> ?

Absolutely ! Good catch !
I will send a patch immediately.


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-03-20  3:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  2:45 [PATCH 0/6] Cleanup and improve libata-scsi command emulation Damien Le Moal
2024-10-22  2:45 ` [PATCH 1/6] ata: libata-scsi: Refactor ata_scsi_simulate() Damien Le Moal
2024-10-22  2:45 ` [PATCH 2/6] ata: libata-scsi: Refactor ata_scsiop_read_cap() Damien Le Moal
2024-10-22  2:45 ` [PATCH 3/6] ata: libata-scsi: Refactor ata_scsiop_maint_in() Damien Le Moal
2026-03-20  2:13   ` Guenter Roeck
2026-03-20  3:08     ` Damien Le Moal [this message]
2024-10-22  2:45 ` [PATCH 4/6] ata: libata-scsi: Document all VPD page inquiry actors Damien Le Moal
2024-10-22  2:45 ` [PATCH 5/6] ata: libata-scsi: Remove struct ata_scsi_args Damien Le Moal
2024-10-22  2:45 ` [PATCH 6/6] ata: libata-scsi: Return residual for emulated SCSI commands Damien Le Moal
2024-10-25  8:15 ` [PATCH 0/6] Cleanup and improve libata-scsi command emulation Niklas Cassel

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=ae9f75cc-23c2-45bc-aaa3-0746ed70e37e@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cassel@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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