From patchwork Tue Jul 25 12:15:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 710062 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08A45C001DE for ; Tue, 25 Jul 2023 12:17:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233038AbjGYMRo (ORCPT ); Tue, 25 Jul 2023 08:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231715AbjGYMRl (ORCPT ); Tue, 25 Jul 2023 08:17:41 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47261A3 for ; Tue, 25 Jul 2023 05:17:40 -0700 (PDT) Received: from dggpemm100019.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R9GGy3Mgwz1GDK1; Tue, 25 Jul 2023 20:16:42 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm100019.china.huawei.com (7.185.36.251) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 25 Jul 2023 20:17:33 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 25 Jul 2023 20:17:33 +0800 From: Yang Yingliang To: CC: , , , , Subject: [PATCH -next] media: i2c: ds90ub960: fix return value check in ub960_rxport_add_serializer() Date: Tue, 25 Jul 2023 20:15:07 +0800 Message-ID: <20230725121507.515435-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org i2c_new_client_device() never returns NULL pointer, it will return ERR_PTR() when it fails, so replace the check with IS_ERR() and use PTR_ERR() as return code. Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") Signed-off-by: Yang Yingliang --- drivers/media/i2c/ds90ub960.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index e101bcf2356a..92aa004a3674 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -1662,10 +1662,10 @@ static int ub960_rxport_add_serializer(struct ub960_data *priv, u8 nport) ser_info.addr = rxport->ser.alias; rxport->ser.client = i2c_new_client_device(priv->client->adapter, &ser_info); - if (!rxport->ser.client) { + if (IS_ERR(rxport->ser.client)) { dev_err(dev, "rx%u: cannot add %s i2c device", nport, ser_info.type); - return -EIO; + return PTR_ERR(rxport->ser.client); } dev_dbg(dev, "rx%u: remote serializer at alias 0x%02x (%u-%04x)\n",