From: kernel test robot <lkp@xxxxxxxxx> drivers/hwmon/amd_energy.c:302:1-3: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci Fixes: 911766432fd2 ("hwmon: (amd_energy) Improve the accumulation logic") CC: Naveen Krishna Chatradhi <nchatrad@xxxxxxx> Signed-off-by: kernel test robot <lkp@xxxxxxxxx> --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next head: 78a28192e301da58ac408f2e98fa30aebafbfda0 commit: 911766432fd2a6054d9813845ad3f48120bd649c [45/55] hwmon: (amd_energy) Improve the accumulation logic amd_energy.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/drivers/hwmon/amd_energy.c +++ b/drivers/hwmon/amd_energy.c @@ -299,10 +299,7 @@ static int amd_energy_probe(struct platf data->wrap_accumulate = kthread_run(energy_accumulator, data, "%s", dev_name(hwmon_dev)); - if (IS_ERR(data->wrap_accumulate)) - return PTR_ERR(data->wrap_accumulate); - - return 0; + return PTR_ERR_OR_ZERO(data->wrap_accumulate); } static int amd_energy_remove(struct platform_device *pdev)