From patchwork Thu Nov 9 15:00:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Belova X-Patchwork-Id: 163410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp492789vqs; Thu, 9 Nov 2023 07:02:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2ygZJDBu8bEEEKiscRH5+UhSQ3Ec9+00lVao5W+NKKWEQi/pBCmYJJ9pgZOFY4REGIrAW X-Received: by 2002:a25:7241:0:b0:c4b:ada8:8b86 with SMTP id n62-20020a257241000000b00c4bada88b86mr5043998ybc.64.1699542157086; Thu, 09 Nov 2023 07:02:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699542157; cv=none; d=google.com; s=arc-20160816; b=uZTY334itXp3Rs2ZvPfg0rJemW9hz9WVMt8I32yiONPrFzprhqXY2S4k9eYUrJITRi 6Em+YE47wGjQniQR6gu46Loq5T/dN/jyERFqPHyhvDiHytdPnW9Fo/iTa3TnB0baYUc6 hkwjqwZfud1b58Lisuk5YRdKqonYDUXVDwwdpfLsDuPvjAVlz7jBmw/233tfiRahAEgj lN77omitiizw2+vAnfgdoQ78UZ8kWiD6vTJ9ACYSVPjbhWocbpvH48V4QXKM5o7PQ9tW aDx2xofHWEmva2TSWVtnl6HQxBljYoqJOWhP53zuhQukFV86Jyi5Za+2gTqp3x8NX3bx tAjw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xotc4UCChjssxMOQZAriYxdNCf5k6FUYRu9rdi/sSec=; fh=6rt5cKnQr+DVKhrdSpLt9yY0Cu/wOP3+tSgylc4MstM=; b=eiHR+Q7JDhS0ATmnptDArsTWZnmA8v2dMaNU8AbyOPkHET7rI98AoaIMbu/Jg2UdHW Ity7ThhAvkZYPOuwJprl1o575xrUm7jGfQCcS7p6VLT67DtKD85h0pEjGXkzoPbirdxx rHKYBpttiuAwZMoLdP/rVhYQTq2qkIjzgUtFHraN0sVs58EHUgpp7oHyEChjd9heoBBk yWmw4VEiBE0fccyKh7G4FTlgHq3RYgBeqjc51JuGyLd0qHKgsRS01XrLilJDhAJPpNzH hDVEth1OW9UsuR1YThG+3xj0gw2ls+czOMe1b8NwjaYmUAuZOov7HqAMm5FNNdTot0PO LK+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t72-20020a25aace000000b00d8470acdee0si9455281ybi.674.2023.11.09.07.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 07:02:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2BDB2804F60D; Thu, 9 Nov 2023 07:01:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234485AbjKIPAw (ORCPT + 31 others); Thu, 9 Nov 2023 10:00:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234073AbjKIPAu (ORCPT ); Thu, 9 Nov 2023 10:00:50 -0500 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03735325B; Thu, 9 Nov 2023 07:00:46 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 5E9311868B41; Thu, 9 Nov 2023 18:00:44 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Twr-pb2i9k6j; Thu, 9 Nov 2023 18:00:44 +0300 (MSK) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id EA2C7186505E; Thu, 9 Nov 2023 18:00:43 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6HsWk-nAyshQ; Thu, 9 Nov 2023 18:00:43 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.14.192]) by mail.astralinux.ru (Postfix) with ESMTPSA id 6F18D18633F8; Thu, 9 Nov 2023 18:00:42 +0300 (MSK) From: Anastasia Belova To: stable@vger.kernel.org, "Greg Kroah-Hartman ." Cc: Anastasia Belova , lvc-project@linuxtesting.org, Mauro Carvalho Chehab , Sakari Ailus , Hans de Goede , Andy Shevchenko , Tsuchiya Yuto , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 5.10/5.15 1/1] media: atomisp: add error checking to atomisp_create_pipes_stream() Date: Thu, 9 Nov 2023 18:00:01 +0300 Message-Id: <20231109150001.22891-2-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20231109150001.22891-1-abelova@astralinux.ru> References: <20231109150001.22891-1-abelova@astralinux.ru> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 07:01:06 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782099058498909211 X-GMAIL-MSGID: 1782099116648938404 From: Hans de Goede commit 798d2ad739da5343122eff386578f259278f2594 upstream. The functions called by atomisp_create_pipes_stream() can fail, add error checking for them. Link: https://lore.kernel.org/linux-media/20220615205037.16549-35-hdegoede@redhat.com Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Anastasia Belova --- .../media/atomisp/pci/atomisp_compat.h | 2 +- .../media/atomisp/pci/atomisp_compat_css20.c | 20 ++++++++++++++++--- .../staging/media/atomisp/pci/atomisp_ioctl.c | 13 ++++++++++-- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat.h b/drivers/staging/media/atomisp/pci/atomisp_compat.h index c16eaf3d126f..75c978c4e6f3 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat.h +++ b/drivers/staging/media/atomisp/pci/atomisp_compat.h @@ -242,7 +242,7 @@ int atomisp_css_input_configure_port(struct atomisp_sub_device *asd, unsigned int metadata_width, unsigned int metadata_height); -void atomisp_create_pipes_stream(struct atomisp_sub_device *asd); +int atomisp_create_pipes_stream(struct atomisp_sub_device *asd); void atomisp_destroy_pipes_stream_force(struct atomisp_sub_device *asd); void atomisp_css_stop(struct atomisp_sub_device *asd, diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c index 99a632f33d2d..f64d73b4c4b7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c @@ -795,10 +795,24 @@ static int __create_pipes(struct atomisp_sub_device *asd) return -EINVAL; } -void atomisp_create_pipes_stream(struct atomisp_sub_device *asd) +int atomisp_create_pipes_stream(struct atomisp_sub_device *asd) { - __create_pipes(asd); - __create_streams(asd); + int ret; + + ret = __create_pipes(asd); + if (ret) { + dev_err(asd->isp->dev, "create pipe failed %d.\n", ret); + return ret; + } + + ret = __create_streams(asd); + if (ret) { + dev_warn(asd->isp->dev, "create stream failed %d.\n", ret); + __destroy_pipes(asd, true); + return ret; + } + + return 0; } int atomisp_css_update_stream(struct atomisp_sub_device *asd) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index b7dda4b96d49..06bb1c87c814 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -2243,8 +2243,17 @@ int __atomisp_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) dev_err(isp->dev, "atomisp_reset"); atomisp_reset(isp); for (i = 0; i < isp->num_of_streams; i++) { - if (recreate_streams[i]) - atomisp_create_pipes_stream(&isp->asd[i]); + if (recreate_streams[i]) { + int ret2; + + ret2 = atomisp_create_pipes_stream(&isp->asd[i]); + if (ret2) { + dev_err(isp->dev, "%s error re-creating streams: %d\n", + __func__, ret2); + if (!ret) + ret = ret2; + } + } } isp->isp_timeout = false; }