Patch "spi: hisi-kunpeng: Add validation for the minimum value of speed_hz" has been added to the 6.10-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

    spi: hisi-kunpeng: Add validation for the minimum value of speed_hz

to the 6.10-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:
     spi-hisi-kunpeng-add-validation-for-the-minimum-valu.patch
and it can be found in the queue-6.10 subdirectory.

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



commit 10cc6b43d951c6b547fa7369e160308e597454ec
Author: Devyn Liu <liudingyuan@xxxxxxxxxx>
Date:   Tue Jul 30 11:20:39 2024 +0800

    spi: hisi-kunpeng: Add validation for the minimum value of speed_hz
    
    [ Upstream commit c3c4f22b7c814a6ee485ce294065836f8ede30fa ]
    
    The speed specified by the user is used to calculate the clk_div based
    on the max_speed_hz in hisi_calc_effective_speed.  A very low speed
    value can lead to a clk_div larger than the variable range. Avoid this
    by setting the min_speed_hz so that such a small speed value is
    rejected.  __spi_validate() in spi.c will return -EINVAL for the
    specified speed_hz lower than min_speed_hz.
    
    Signed-off-by: Devyn Liu <liudingyuan@xxxxxxxxxx>
    Reviewed-by: Jay Fang <f.fangjian@xxxxxxxxxx>
    Link: https://patch.msgid.link/20240730032040.3156393-2-liudingyuan@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/spi/spi-hisi-kunpeng.c b/drivers/spi/spi-hisi-kunpeng.c
index 77e9738e42f60..6910b4d4c427b 100644
--- a/drivers/spi/spi-hisi-kunpeng.c
+++ b/drivers/spi/spi-hisi-kunpeng.c
@@ -495,6 +495,7 @@ static int hisi_spi_probe(struct platform_device *pdev)
 	host->transfer_one = hisi_spi_transfer_one;
 	host->handle_err = hisi_spi_handle_err;
 	host->dev.fwnode = dev->fwnode;
+	host->min_speed_hz = DIV_ROUND_UP(host->max_speed_hz, CLK_DIV_MAX);
 
 	hisi_spi_hw_init(hs);
 




[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