From patchwork Wed Jan 10 18:55:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 186989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp989422dyi; Wed, 10 Jan 2024 10:55:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsCahm7mfzgri9gw8R7hsTlLaVL41plYSAisYeQ3vDAt88DQ6y5E4k9zdMCMBrr1Nrcj/D X-Received: by 2002:ac8:7d81:0:b0:429:ab35:6402 with SMTP id c1-20020ac87d81000000b00429ab356402mr12459qtd.2.1704912951257; Wed, 10 Jan 2024 10:55:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704912951; cv=none; d=google.com; s=arc-20160816; b=UcNSQl+j0rwpiR/OkDrGFR3JmVtIZS285cT59LOo0muG0D+ulApck5ijsClf7SQKDL 8Rh3NBiPQS/3i8SeyJN1EpF+xMYiWJeK0n5bUn420J2Xes/MpDmE+A5RoB35pH1Q/7Wk TAHEAF1nTTNNlFqHTXK+NfT1V3T9jsKnfmxYnepqC+zqKyViXwnn/S+Z0wedKJpD5xEE 6d92tK0CGURQPU3YdoxQcKBHZe9uUr1xBR4uBIxG0rXRCU6GvozY5L115vA6q7c8iQ9m vzBkomNZUE6GohGfGPSJQrWylDuaIDjnK1/bWVedT2q3v0nZ2DJ1Y2ikDsCPRg9nnGxz GCRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=Z0heHeyuUTmHqc6WZOFLnzwUnJCGatTB1E3vLULOVOM=; fh=e2xI8G5AFPU/+mhWcS94k8+18uIjYLhoe0ssNmDFAis=; b=HOa2OkNP/LtayRhDKUl1TlEsDe4xqbnw534+TBOsxBU3rLsT82tZ8c3RgCpdcflYSb A2ZQJfsi34G1tYI46TCt8nj74JO3RnWMS05Ncx3GheU8TgndOivRSRAGLQ7jlXM9IM16 835NR+DhbzmF9sRUQhCFpn4ZbOf3i4T/ioqqpuGxatN0YOjrWEsefLUViNLGcrigjVcI oKBL4/mfw0aPpMc2k813P4oL039+9+FpXX6ruxDoxp6UgTxY7oFE9gCfl/Hu+LCvNyxt CxDWPDnvGbyuipoBIdXicHqjctf8WBQiZiROmhknAVRq24ukYSz/YDJpylLx+p/O9qG8 cZHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oYZMg65v; spf=pass (google.com: domain of linux-kernel+bounces-22621-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22621-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ff22-20020a05622a4d9600b0042976f7ddefsi4943592qtb.653.2024.01.10.10.55.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 10:55:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22621-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oYZMg65v; spf=pass (google.com: domain of linux-kernel+bounces-22621-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22621-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0FE681C20C97 for ; Wed, 10 Jan 2024 18:55:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 663394D5BB; Wed, 10 Jan 2024 18:55:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oYZMg65v" Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52D854D58D for ; Wed, 10 Jan 2024 18:55:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3368ae75082so3120476f8f.1 for ; Wed, 10 Jan 2024 10:55:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704912917; x=1705517717; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=Z0heHeyuUTmHqc6WZOFLnzwUnJCGatTB1E3vLULOVOM=; b=oYZMg65vLORI2HN8FquB/zRMRjARN0ARGVYxB3e80ex4K5uBVgFM3VzgGZUrhMpi63 s+SuuLp8cgiTYydZDVBLOM06zx9t5ILJyDmc9g6+vqOUHUnfI0ywQlwbF6G1kvgm0aF+ McmWpYN2aaD/XjRf2Go7saVHnP453W6CNoIZAKxVQm6uqM6iAP+jz3533nwIjhzCNjsZ vm1MUqw/V8ZYljHKiDwL82Qe90e/ZpmUXBDXFz4n/wVhvuvkEM0FLnpNPv+HIy5Vbznc I+0qAA1eanSzcSnFAtHH0OwH8LhFJEHjJj+bfuXCK2A93q0Dn52awyX2MZALPt7Thm4p zSwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704912917; x=1705517717; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z0heHeyuUTmHqc6WZOFLnzwUnJCGatTB1E3vLULOVOM=; b=l8pbsyf5z9w5Zs0m4xxk07BIi6fRabSeR4ivrPMfyJYfNh1TsA+ip1tibA9amvMfO0 FyvmD7gATZOoRrMOxIyKFhb5HvoQIAEdg5Yf60l3VXgR589C6w/h7b6BCSuP0dEsQUF2 rcUfKt3qKBUoxwtkFvrsiJQwIIl9DBY54o5fvbiSXvtnvDM7tV2JRLvZUVVD9mekPO1/ MfKicgrlbRyVj2CpLlqZSCB1IE28709y22MUfRwdUvItSujGGR68W/k8+FDsk6MGHcd5 w5MkKG5bqqUGhYgkfbYOsxQsKyDnIXHhhT3b9MO8DCXE36zWZE/xUSuon2gxiiC1kZvQ lebg== X-Gm-Message-State: AOJu0YyCGX0hwJv3mnohtyf7w28Bfz2iK5bji3wD4UYfQhNuBJS2f9GQ y/G36deUbxa67UoF1uBhZSP/a7ntWtWukkOtbsrW3rB8GQk= X-Received: by 2002:a05:600c:c86:b0:40e:3edf:1057 with SMTP id fj6-20020a05600c0c8600b0040e3edf1057mr315129wmb.0.1704912917773; Wed, 10 Jan 2024 10:55:17 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id j28-20020a05600c1c1c00b0040e52f0e207sm690567wms.0.2024.01.10.10.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 10:55:17 -0800 (PST) Date: Wed, 10 Jan 2024 21:55:14 +0300 From: Dan Carpenter To: "davidgow@google.com" Cc: Brendan Higgins , Shuah Khan , Matti Vaittinen , Maxime Ripard , Greg Kroah-Hartman , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] kunit: device: Fix a NULL vs IS_ERR() check in init() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787730802298145487 X-GMAIL-MSGID: 1787730802298145487 The root_device_register() function does not return NULL, it returns error pointers. Fix the check to match. Fixes: d03c720e03bd ("kunit: Add APIs for managing devices") Signed-off-by: Dan Carpenter --- lib/kunit/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kunit/device.c b/lib/kunit/device.c index f5371287b375..074c6dd2e36a 100644 --- a/lib/kunit/device.c +++ b/lib/kunit/device.c @@ -45,8 +45,8 @@ int kunit_bus_init(void) int error; kunit_bus_device = root_device_register("kunit"); - if (!kunit_bus_device) - return -ENOMEM; + if (IS_ERR(kunit_bus_device)) + return PTR_ERR(kunit_bus_device); error = bus_register(&kunit_bus_type); if (error)