[PATCH 21/61] lib/test: Prefer IS_ERR_OR_NULL over manual NULL check
Philipp Hahn <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel,gmane.comp.freedesktop.amd-gfx,gmane.comp.security.apparmor,gmane.linux.kernel.bpf,gmane.comp.file-systems.ceph.devel,gmane.comp.video.dri.devel,gmane.comp.freedesktop.xorg.drivers.intel,gmane.comp.emulators.kvm.devel,gmane.linux.ports.arm.kernel,gmane.linux.block,gmane.linux.bluez.kernel,gmane.comp.file-systems.btrfs,gmane.linux.kernel.cifs,gmane.linux.kernel.clk,gmane.comp.file-systems.ext4,gmane.linux.file-systems,gmane.linux.kernel.gpio,gmane.linux.kernel.input,gmane.linux.kernel,gmane.linux.leds,gmane.linux.drivers.video-input-infrastructure,gmane.linux.ports.mips,gmane.linux.kernel.mm,gmane.linux.kernel.modules,gmane.linux.drivers.mtd,gmane.linux.nfs,gmane.linux.ports.arm.omap |
|---|---|
| Message-ID | <[email protected]> |
Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL check. Change generated with coccinelle. To: Andrew Morton <[email protected]> To: Luis Chamberlain <[email protected]> To: Petr Pavlu <[email protected]> To: Daniel Gomez <[email protected]> To: Sami Tolvanen <[email protected]> To: Aaron Tomlin <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Philipp Hahn <[email protected]> --- lib/test_firmware.c | 2 +- lib/test_kmod.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/test_firmware.c b/lib/test_firmware.c index b471d720879a70c0db82e605960abe69de28ab4b..fc3177927a02e2d7849915309048529395ece0f8 100644 --- a/lib/test_firmware.c +++ b/lib/test_firmware.c @@ -955,7 +955,7 @@ static ssize_t trigger_batched_requests_store(struct device *dev, init_completion(&req->completion); req->task = kthread_run(test_fw_run_batch_request, req, "%s-%u", KBUILD_MODNAME, req->idx); - if (!req->task || IS_ERR(req->task)) { + if (IS_ERR_OR_NULL(req->task)) { pr_err("Setting up thread %u failed\n", req->idx); req->task = NULL; rc = -ENOMEM; diff --git a/lib/test_kmod.c b/lib/test_kmod.c index f0dd092860ea6f9c69a71e10cb1c8b071b1cd1b7..f44a181f6f1ab53cf95a0a0b598b88cb5f8f369d 100644 --- a/lib/test_kmod.c +++ b/lib/test_kmod.c @@ -327,7 +327,7 @@ static int try_one_request(struct kmod_test_device *test_dev, unsigned int idx) info->task_sync = kthread_run(run_request, info, "%s-%u", KBUILD_MODNAME, idx); - if (!info->task_sync || IS_ERR(info->task_sync)) { + if (IS_ERR_OR_NULL(info->task_sync)) { test_dev->test_is_oom = true; dev_err(test_dev->dev, "Setting up thread %u failed\n", idx); info->task_sync = NULL; @@ -358,7 +358,7 @@ static void test_dev_kmod_stop_tests(struct kmod_test_device *test_dev) for (i=0; i < config->num_threads; i++) { info = &test_dev->info[i]; - if (info->task_sync && !IS_ERR(info->task_sync)) { + if (!IS_ERR_OR_NULL(info->task_sync)) { dev_info(test_dev->dev, "Stopping still-running thread %i\n", i); kthread_stop(info->task_sync); -- 2.43.0