Patch "iio: xilinx-ams: Don't include ams_ctrl_channels in scan_mask" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iio: xilinx-ams: Don't include ams_ctrl_channels in scan_mask

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iio-xilinx-ams-don-t-include-ams_ctrl_channels-in-sc.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 206cbd130c054285376619ac4c3eab47798ec0c4
Author: Sean Anderson <sean.anderson@xxxxxxxxx>
Date:   Mon Mar 11 12:28:00 2024 -0400

    iio: xilinx-ams: Don't include ams_ctrl_channels in scan_mask
    
    [ Upstream commit 89b898c627a49b978a4c323ea6856eacfc21f6ba ]
    
    ams_enable_channel_sequence constructs a "scan_mask" for all the PS and
    PL channels. This works out fine, since scan_index for these channels is
    less than 64. However, it also includes the ams_ctrl_channels, where
    scan_index is greater than 64, triggering undefined behavior. Since we
    don't need these channels anyway, just exclude them.
    
    Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")
    Signed-off-by: Sean Anderson <sean.anderson@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20240311162800.11074-1-sean.anderson@xxxxxxxxx
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
index a507d2e170792..3db021b96ae9d 100644
--- a/drivers/iio/adc/xilinx-ams.c
+++ b/drivers/iio/adc/xilinx-ams.c
@@ -414,8 +414,12 @@ static void ams_enable_channel_sequence(struct iio_dev *indio_dev)
 
 	/* Run calibration of PS & PL as part of the sequence */
 	scan_mask = BIT(0) | BIT(AMS_PS_SEQ_MAX);
-	for (i = 0; i < indio_dev->num_channels; i++)
-		scan_mask |= BIT_ULL(indio_dev->channels[i].scan_index);
+	for (i = 0; i < indio_dev->num_channels; i++) {
+		const struct iio_chan_spec *chan = &indio_dev->channels[i];
+
+		if (chan->scan_index < AMS_CTRL_SEQ_BASE)
+			scan_mask |= BIT_ULL(chan->scan_index);
+	}
 
 	if (ams->ps_base) {
 		/* put sysmon in a soft reset to change the sequence */




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux