From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56554C4321E for ; Sat, 26 Nov 2022 02:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=fF0GYfLN4/I3rtV2mZ6pGiE/z2lbpXCSdaygUGv1nM0=; b=XqqhZsuA/MKvJw BfvxNMOckjZCJDGn4uiEfDfiE6rb1SLsNiXndFaUmqdCCeEa94DU/ipDW/C+BIXirHp5br1j/acHB etJNwUNWVDlc1JlSnNgLFad4W3ivZb+JmEobVgVDJMCP4GjkQwoEwZQITOKOOY8B7XuYrYJ/s2Rio KQlBILl2Zon8I/sTOHhaB2+VMhg1AHrhUtBPjspwQNQblZzuW62i3k9jvIuPC3g7+un20bmKaKpBb psPL6VOytNjtvi7UzQoLLtcudM3ylYHEBkBJyWdTx656ri5b8Pc0FwI3a/OUtOFqYE0qp+ZtiX2dg e3WZSq3w01H/gV5wYfnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oykxa-003d9j-RC; Sat, 26 Nov 2022 02:30:30 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oykxX-003d6p-3q for linux-arm-kernel@lists.infradead.org; Sat, 26 Nov 2022 02:30:29 +0000 Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NJwfx11zxzRpXl; Sat, 26 Nov 2022 10:29:45 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 26 Nov 2022 10:30:18 +0800 From: Zheng Yongjun To: , , , , , , CC: , Subject: [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create() Date: Sat, 26 Nov 2022 02:28:13 +0000 Message-ID: <20221126022813.57372-1-zhengyongjun3@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221125_183027_341673_311D69A7 X-CRM114-Status: UNSURE ( 9.90 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In case of error, the function debugfs_create_file() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 52fed10ad756 ("media: aspeed: add debugfs") Signed-off-by: Zheng Yongjun --- v2: - change return error code from ERR_PTR to PTR_ERR. drivers/media/platform/aspeed/aspeed-video.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/aspeed/aspeed-video.c b/drivers/media/platform/aspeed/aspeed-video.c index 20f795ccc11b..0113e6bc836f 100644 --- a/drivers/media/platform/aspeed/aspeed-video.c +++ b/drivers/media/platform/aspeed/aspeed-video.c @@ -1780,10 +1780,12 @@ static int aspeed_video_debugfs_create(struct aspeed_video *video) debugfs_entry = debugfs_create_file(DEVICE_NAME, 0444, NULL, video, &aspeed_video_debugfs_ops); - if (!debugfs_entry) + if (IS_ERR(debugfs_entry)) { aspeed_video_debugfs_remove(video); + return PTR_ERR(debugfs_entry); + } - return !debugfs_entry ? -EIO : 0; + return 0; } #else static void aspeed_video_debugfs_remove(struct aspeed_video *video) { } -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel