Patch "i2c: sun6i-p2wi: Prevent potential division by zero" has been added to the 6.6-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

    i2c: sun6i-p2wi: Prevent potential division by zero

to the 6.6-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:
     i2c-sun6i-p2wi-prevent-potential-division-by-zero.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 1a5f04bd96d053f83119da368dc3c87fe93013ec
Author: Axel Lin <axel.lin@xxxxxxxxxx>
Date:   Wed Apr 13 08:54:30 2016 +0800

    i2c: sun6i-p2wi: Prevent potential division by zero
    
    [ Upstream commit 5ac61d26b8baff5b2e5a9f3dc1ef63297e4b53e7 ]
    
    Make sure we don't OOPS in case clock-frequency is set to 0 in a DT. The
    variable set here is later used as a divisor.
    
    Signed-off-by: Axel Lin <axel.lin@xxxxxxxxxx>
    Acked-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/i2c/busses/i2c-sun6i-p2wi.c b/drivers/i2c/busses/i2c-sun6i-p2wi.c
index fa6020dced595..85e035e7a1d75 100644
--- a/drivers/i2c/busses/i2c-sun6i-p2wi.c
+++ b/drivers/i2c/busses/i2c-sun6i-p2wi.c
@@ -201,6 +201,11 @@ static int p2wi_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
+	if (clk_freq == 0) {
+		dev_err(dev, "clock-frequency is set to 0 in DT\n");
+		return -EINVAL;
+	}
+
 	if (of_get_child_count(np) > 1) {
 		dev_err(dev, "P2WI only supports one slave device\n");
 		return -EINVAL;



[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