Patch "OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()" has been added to the 6.4-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

    OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()

to the 6.4-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:
     opp-fix-passing-0-to-ptr_err-in-_opp_attach_genpd.patch
and it can be found in the queue-6.4 subdirectory.

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



commit 5ce9630c85c9134b424513a8030c6c03d4e62c09
Author: Manivannan Sadhasivam <mani@xxxxxxxxxx>
Date:   Fri Jul 21 18:16:34 2023 +0530

    OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()
    
    [ Upstream commit d920920f85a82c1c806a4143871a0e8f534732f2 ]
    
    If dev_pm_domain_attach_by_name() returns NULL, then 0 will be passed to
    PTR_ERR() as reported by the smatch warning below:
    
    drivers/opp/core.c:2456 _opp_attach_genpd() warn: passing zero to 'PTR_ERR'
    
    Fix it by checking for the non-NULL virt_dev pointer before passing it to
    PTR_ERR. Otherwise return -ENODEV.
    
    Fixes: 4ea9496cbc95 ("opp: Fix error check in dev_pm_opp_attach_genpd()")
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
    Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index b5973fefdfd83..75b43c6c7031c 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2382,7 +2382,7 @@ static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev,
 
 		virt_dev = dev_pm_domain_attach_by_name(dev, *name);
 		if (IS_ERR_OR_NULL(virt_dev)) {
-			ret = PTR_ERR(virt_dev) ? : -ENODEV;
+			ret = virt_dev ? PTR_ERR(virt_dev) : -ENODEV;
 			dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret);
 			goto err;
 		}



[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