diff mbox series

[v3,1/4] ata: libata-scsi: Fix ata_mselect_control_ata_feature() return type

Message ID 20250418230623.375686-2-dlemoal@kernel.org
State Superseded
Headers show
Series CDL Feature control improvements | expand

Commit Message

Damien Le Moal April 18, 2025, 11:06 p.m. UTC
The function ata_mselect_control_ata_feature() has a return type defined
as unsigned int but this function may return negative error codes, which
are correctly propagated up the call chain as integers.

Fix ata_mselect_control_ata_feature() to have the correct int return
type.

While at it, also fix a typo in this function description comment.

Fixes: df60f9c64576 ("scsi: ata: libata: Add ATA feature control sub-page translation")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
---
 drivers/ata/libata-scsi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Igor Pylypiv April 18, 2025, 11:14 p.m. UTC | #1
On Sat, Apr 19, 2025 at 08:06:20AM +0900, Damien Le Moal wrote:
> The function ata_mselect_control_ata_feature() has a return type defined
> as unsigned int but this function may return negative error codes, which
> are correctly propagated up the call chain as integers.
> 
> Fix ata_mselect_control_ata_feature() to have the correct int return
> type.
> 
> While at it, also fix a typo in this function description comment.
> 
> Fixes: df60f9c64576 ("scsi: ata: libata: Add ATA feature control sub-page translation")
> Cc: stable@vger.kernel.org
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> Reviewed-by: Niklas Cassel <cassel@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Nice catch!

> ---
>  drivers/ata/libata-scsi.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 2796c0da8257..24e662c837e3 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3886,12 +3886,11 @@ static int ata_mselect_control_spg0(struct ata_queued_cmd *qc,
>  }
>  
>  /*
> - * Translate MODE SELECT control mode page, sub-pages f2h (ATA feature mode
> + * Translate MODE SELECT control mode page, sub-page f2h (ATA feature mode
>   * page) into a SET FEATURES command.
>   */
> -static unsigned int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
> -						    const u8 *buf, int len,
> -						    u16 *fp)
> +static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
> +					   const u8 *buf, int len, u16 *fp)
>  {
>  	struct ata_device *dev = qc->dev;
>  	struct ata_taskfile *tf = &qc->tf;
> -- 
> 2.49.0
> 
>
diff mbox series

Patch

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 2796c0da8257..24e662c837e3 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3886,12 +3886,11 @@  static int ata_mselect_control_spg0(struct ata_queued_cmd *qc,
 }
 
 /*
- * Translate MODE SELECT control mode page, sub-pages f2h (ATA feature mode
+ * Translate MODE SELECT control mode page, sub-page f2h (ATA feature mode
  * page) into a SET FEATURES command.
  */
-static unsigned int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
-						    const u8 *buf, int len,
-						    u16 *fp)
+static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc,
+					   const u8 *buf, int len, u16 *fp)
 {
 	struct ata_device *dev = qc->dev;
 	struct ata_taskfile *tf = &qc->tf;