Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1890195pxb; Mon, 13 Sep 2021 07:36:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUfbs5F6QRxMtdxUX2Mfpc6o7N55Xos1XmIeUpjIyVS/7drfjbQ9EKq2obt9F3+tpfl5g/ X-Received: by 2002:a17:906:4346:: with SMTP id z6mr13025786ejm.403.1631543785590; Mon, 13 Sep 2021 07:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631543785; cv=none; d=google.com; s=arc-20160816; b=o/9L8jFYbIblnUMCmERVBHXMq7XvcfYQemoEw4frx+PZ6qXvxht0TUvBiOWZpkiQXD LBg+DkbBjZghscCiYMojehUYTlKWwMrlOmd9zSj8ZjUlT24eg9qDtUCH2WzWkFsegFqq 8Tc3shySb21d/YnhzAUvDBYPo74nqWlzlzpt7ahv8W8HrYKgVzzvDOeZy+VNHsbyaDs/ /y1Hj4UxThC6yGMhO1gi0DwBjKzY8YLjOIOGRSP4zCf9rkQDcCqt6MGwKRlCRc0LqDWM bvUpM7+InoLviKtlxUfpICYEgXwg4imGXMneSbLpGyk7WApUEN0dRd4H0Tb1Zv7qTjD+ 7lKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AYGcb5LcMeg3WjxILdZyh6/bf8LyzZoCvsNN3AKzoWg=; b=IEGxsH6CqB3MWHdBoxfgSLAXxg8ptFxJes1DCGJh4e1petOa4puoxKgumth0uIhTO4 qWZlLH3kb+8I6RjyaD5MyY+EHhzVJeVkiSWLXtCFaKn5hvGCMSPskakR9jtOOdSx3bck oLlWIN77QipVros6MetgSo22uybSrTV3lh10xpotYDRf2AznGspvDrtFZcF7QMUYHlXP h1xN8kd1g/ZhQoE2Z8hD462zBiEAfSN8MV3DyyoWYefACIRJqpKY4sd0bp0Wju8qdr9V iJmrZ+MTVoh56EEBLgN0BIG52NzwCjYHxk6f/pnEGyXX5FzpJnhZZ+VeJfIkEZXm2pIf OOpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A6StdobX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jz11si7075431ejc.137.2021.09.13.07.36.00; Mon, 13 Sep 2021 07:36:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A6StdobX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343690AbhIMOde (ORCPT + 99 others); Mon, 13 Sep 2021 10:33:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:46952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344321AbhIMO2a (ORCPT ); Mon, 13 Sep 2021 10:28:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D8C8D615A3; Mon, 13 Sep 2021 13:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540990; bh=tNweOmfPT6ce2e92V44yvyf7Jg8MztMluPrsKAcB4Mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A6StdobX8EtZCaiRrxDm/ZVaYG7E3CTWYz0q3h6S+Zb0+gcDoQbF5NIFG5DYNDNQ9 UJJKOH/kuJKGCuK7UeQ0chu1M91HU0gyKekraqDjZgQfhhihiTdFP1AYzdzxPy2Q2Z /1SDpdSbHZ9lxmEZn0EJQdpK3yOPUbb9vK0erNVc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Laurent Pinchart , Sakari Ailus , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.14 117/334] media: v4l2-subdev: fix some NULL vs IS_ERR() checks Date: Mon, 13 Sep 2021 15:12:51 +0200 Message-Id: <20210913131117.327547204@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131113.390368911@linuxfoundation.org> References: <20210913131113.390368911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit ba7a93e507f88306d7a19a1dcb53b857b790cfb8 ] The v4l2_subdev_alloc_state() function returns error pointers, it doesn't return NULL. Fixes: 0d346d2a6f54 ("media: v4l2-subdev: add subdev-wide state struct") Signed-off-by: Dan Carpenter Reviewed-by: Laurent Pinchart Acked-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++-- drivers/media/platform/vsp1/vsp1_entity.c | 4 ++-- drivers/staging/media/tegra-video/vi.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index cca15a10c0b3..0d141155f0e3 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -253,8 +253,8 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which, int ret; sd_state = v4l2_subdev_alloc_state(sd); - if (sd_state == NULL) - return -ENOMEM; + if (IS_ERR(sd_state)) + return PTR_ERR(sd_state); if (!rvin_format_from_pixel(vin, pix->pixelformat)) pix->pixelformat = RVIN_DEFAULT_FORMAT; diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index 6f51e5c75543..823c15facd1b 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c @@ -676,9 +676,9 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, * rectangles. */ entity->config = v4l2_subdev_alloc_state(&entity->subdev); - if (entity->config == NULL) { + if (IS_ERR(entity->config)) { media_entity_cleanup(&entity->subdev.entity); - return -ENOMEM; + return PTR_ERR(entity->config); } return 0; diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index 89709cd06d4d..d321790b07d9 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -508,8 +508,8 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan, return -ENODEV; sd_state = v4l2_subdev_alloc_state(subdev); - if (!sd_state) - return -ENOMEM; + if (IS_ERR(sd_state)) + return PTR_ERR(sd_state); /* * Retrieve the format information and if requested format isn't * supported, keep the current format. -- 2.30.2