On Tue, 23 Sep 2025 14:21:03 +0300 Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > Hello Kory Maincent, > > Commit 675d0e3cacc3 ("net: pse-pd: Avoid setting max_uA in regulator > constraints") from Jan 10, 2025 (linux-next), leads to the following > Smatch static checker warning: > > drivers/net/pse-pd/pse_core.c:810 pse_pi_set_current_limit() > warn: AAA no lower bound on 'max_uA' rl='s32min-(-1),1-1920000' > > drivers/net/pse-pd/pse_core.c > 783 static int pse_pi_set_current_limit(struct regulator_dev *rdev, int > min_uA, 784 int max_uA) > 785 { > 786 struct pse_controller_dev *pcdev = rdev_get_drvdata(rdev); > 787 const struct pse_controller_ops *ops; > 788 int id, mW, ret; > 789 s64 tmp_64; > 790 > 791 ops = pcdev->ops; > 792 if (!ops->pi_set_pw_limit || !ops->pi_get_voltage) > 793 return -EOPNOTSUPP; > 794 > 795 if (max_uA > MAX_PI_CURRENT) > > Do we need this? Shouldn't it be checked in regulator_check_current_limit() > instead? max_uA is an int. Do we need to check for negatives? No we can't use max_uA in the regulator constraints as I wrote it in the commit message: "Setting the max_uA constraint in the regulator API imposes a current limit during the regulator registration process. This behavior conflicts with preserving the maximum PI power budget configuration across reboots." Maybe we need to add a negative check to remove this smatch warning. Regards, -- Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com