mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
hwmon: Fix wrong return errno in *sanitize_name()
Currently if user of *sanitize_name() function gives nullptr for name they get's ENOMEM. Logically it should be EINVAL. Signed-off-by: Kari Argillander <kari.argillander@gmail.com> Link: https://lore.kernel.org/r/20251219-hwmon-fixes-v1-1-21b29097ea3b@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
9ef5c1065c
commit
aa8126b914
|
|
@ -1260,6 +1260,9 @@ static char *__hwmon_sanitize_name(struct device *dev, const char *old_name)
|
|||
*/
|
||||
char *hwmon_sanitize_name(const char *name)
|
||||
{
|
||||
if (!name)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
return __hwmon_sanitize_name(NULL, name);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hwmon_sanitize_name);
|
||||
|
|
@ -1276,7 +1279,7 @@ EXPORT_SYMBOL_GPL(hwmon_sanitize_name);
|
|||
*/
|
||||
char *devm_hwmon_sanitize_name(struct device *dev, const char *name)
|
||||
{
|
||||
if (!dev)
|
||||
if (!dev || !name)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
return __hwmon_sanitize_name(dev, name);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user