thermal: bcm2835: no need to check return value of debugfs_create functions
Subsystems (3)
PATCH 1/1 thermal: bcm2835: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- drivers/thermal/broadcom/bcm2835_thermal.c | 2 -- 1 file changed, 2 deletions(-)
drivers/thermal/broadcom/bcm2835_thermal.c +0 -2
@@ -123,8 +123,6 @@ static void bcm2835_thermal_debugfs(struct platform_device *pdev)struct debugfs_regset32 *regset; data->debugfsdir =debugfs_create_dir ("bcm2835_thermal" ,NULL ); -if (!data->debugfsdir) -return ; regset =devm_kzalloc (&pdev->dev,sizeof (*regset),GFP_KERNEL );if (!regset)
Signature · 1 line
2.22.0
Quoted 3 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Sorry if I'm missing some context but does it mean we do no longer take care of roll-backing anything? It is acceptable to have half of the debugfs set for example? Or a parent failing to create and the children polluting the root debugfs dir because the parent is NULL?
Quoted 27 lines
Cc Zhang Rui <[email protected]>Cc Eduardo Valentin <[email protected]>Cc Daniel Lezcano <[email protected]>Cc Florian Fainelli <[email protected]>Cc Ray Jui <[email protected]>Cc Scott Branden <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/thermal/broadcom/bcm2835_thermal.c | 2 -- 1 file changed, 2 deletions(-)drivers/thermal/broadcom/bcm2835_thermal.c +0
-2@@ -123,8 +123,6 @@ static void bcm2835_thermal_debugfs(struct platform_device *pdev)struct debugfs_regset32 *regset; data->debugfsdir =debugfs_create_dir ("bcm2835_thermal" ,NULL ); -if (!data->debugfsdir) -return ; regset =devm_kzalloc (&pdev->dev,sizeof (*regset),GFP_KERNEL );if (!regset)
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 7 lines · Daniel Lezcano
Quoted 3 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Sorry if I'm missing some context but does it mean we do no longer take care of roll-backing anything?
Yes, but how can that happen here?
Quoted 1 line
It is acceptable to have half of the debugfs set for example?
Yes, your code should never care about this.
Quoted 2 lines
Or a parent failing to create and the children polluting the root debugfs dir because the parent is NULL?
How can the parent be NULL? Remember, debugfs_create_dir() can never return NULL, so that should not happen. And even if it does, that's fine, who cares :)
thanks,
greg k-h
Quoted 13 lines · Greg Kroah-Hartman
Quoted 7 lines · Daniel Lezcano
Quoted 3 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Sorry if I'm missing some context but does it mean we do no longer take care of roll-backing anything?
Yes, but how can that happen here?
Quoted 1 line
It is acceptable to have half of the debugfs set for example?
Quoted 8 lines
Yes, your code should never care about this.
Quoted 2 lines
Or a parent failing to create and the children polluting the root debugfs dir because the parent is NULL?
How can the parent be NULL? Remember,
debugfs_create_dir()can never return NULL, so that should not happen. And even if it does, that's fine, who cares :)
Right, debugfs_create_dir() returns an PTR_ERR which can be passed to debugfs_create_file() as the parent parameter but this is handled in start_creating().
Ok, thanks for the clarification.
-- Daniel
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog