From patchwork Fri Nov 25 09:24:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Yongjun X-Patchwork-Id: 25888 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3879462wrr; Fri, 25 Nov 2022 01:27:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf7K7JDzOQClgRldQy5N2opwxEtRsiHu9EH99QTyn/nv47dxqZ1PBtg8i7cWEH4pGm3YNok+ X-Received: by 2002:a17:902:f68a:b0:188:4ea8:a685 with SMTP id l10-20020a170902f68a00b001884ea8a685mr17492887plg.71.1669368476120; Fri, 25 Nov 2022 01:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669368476; cv=none; d=google.com; s=arc-20160816; b=OX5VVH7R1HeuQ/WkUrYVMtlwTJm6rfhnMmPpynM5dRpG4wjMx0FilKzT7Wqhj1Kg6R AnV6jTwrE5bfPe6CQSfqsPa4+DJY/4ob2lbu1NmRSoyTTxYgYwIxwoTwQs2VW4WP8s1N wnc3d+XUHV/I2vJhCc6+RkZKZ43gvp2zqsEqYEHrU9sXipBj4epGlzgTzCHDcDkzRY5r CbMHiE8t54ErA4OMDJf4DKQSgXWfwGbXPsd+0XqsAGf1sQEH+wiWN0YvZByDBJVmdCTY Mfuf9qPBro+bc8kWyWAFH6qXMFQSqZu5Xng8QeqvqUbC/TXcMhRvfdfsg+m01feIQMWF BK7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=UP7fUU27eErGfbdIXJHLHR4Fjn4kOmJqF8I6XdKIQx4=; b=H6jzbQtYqjEOdKgCvVN961Ha6K3fqoAortF2mNhDPruti2Q0v6fENtTuwUv8hTl+Sv 98wmpOThjFel2Sv0xNTWr9d2cIApC/q32BztEnDB2UI+wwubMf2HronxlYEQwn/KgoYA 78g5GuOPjMFbvsAFwDme8U5PPPnvBPmXLsTgduBL8xvwDpvZHxlXUB9CRv7GeTEpihjt CVsHdBxNysQC82l4aeO5MuBtDslEqjZQl4ewRmOIVte+us5Cv19VINtyN4pycZcX190T gg94io1TostjU5NtDsO4AuSfwMvG/DEnLiCWGsmefjq8mTV5y+95d8GUwumvxcvBEIzR i3Vg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cp8-20020a056a00348800b005745eb6c2e1si3023327pfb.182.2022.11.25.01.27.43; Fri, 25 Nov 2022 01:27:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbiKYJ0x (ORCPT + 99 others); Fri, 25 Nov 2022 04:26:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbiKYJ02 (ORCPT ); Fri, 25 Nov 2022 04:26:28 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 708F9326F1; Fri, 25 Nov 2022 01:26:21 -0800 (PST) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NJTxQ1ltpz15Mv1; Fri, 25 Nov 2022 17:25:46 +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; Fri, 25 Nov 2022 17:26:18 +0800 From: Zheng Yongjun To: , , , , , , CC: , Subject: [PATCH] media: aspeed: Fix return value check in aspeed_video_debugfs_create() Date: Fri, 25 Nov 2022 09:24:15 +0000 Message-ID: <20221125092415.29635-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: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750459719130622108?= X-GMAIL-MSGID: =?utf-8?q?1750459719130622108?= 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 --- drivers/media/platform/aspeed/aspeed-video.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/aspeed/aspeed-video.c b/drivers/media/platform/aspeed/aspeed-video.c index 20f795ccc11b..c8fc2450e409 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 ERR_PTR(debugfs_entry); + } - return !debugfs_entry ? -EIO : 0; + return 0; } #else static void aspeed_video_debugfs_remove(struct aspeed_video *video) { }