From patchwork Mon Apr 29 15:04:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 793055 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89E601292F3 for ; Mon, 29 Apr 2024 15:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403111; cv=none; b=RsgR7F0LVmaWcN1EMR6/QuVllkuKHBzHfkmGJSSagvrjLq2Th3o2lvQSuOGlKLypQQcGW+ehJdE6azPUrAjzKnnSbs9VYYuLOk8Ec369KUJ6ERIz5UvXIgHSS0yAryO3sE3YDoL16XQ72aNvSmbPSsnwvCUobKgos37mM99syA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714403111; c=relaxed/simple; bh=m351M6HyiT8IWLkyID5itxiSqWILJmFaZ7lxVFnP6BY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WgaV41bvoI78xITxwpUZXHvHM3+ySS/OzoWaeH/qYRSImo3iWRR6KNMSJD8GFgKUrFxF3o3okkO+Heb6z8LUpTCkVRqyE54TDWzsW2a+/j1MA/Q+f1+nheHX4dFAnZTy3J8AiEn/lVylPhKTGJ8rItJ/sZW8PdI84Bybs5mKng4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=TY6b9Pid; arc=none smtp.client-ip=209.85.160.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TY6b9Pid" Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-238fd648224so1885492fac.2 for ; Mon, 29 Apr 2024 08:05:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1714403103; x=1715007903; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gMpzOFCFY/OFyCB78Iqov2ITRER3c7lueX7XaC40UJk=; b=TY6b9Pidc+6498RPchHOExgjw+jJIHiW+kXEE3OWSAmidYED2CiJ+mFVyOC5XU0BVZ tk0bB5i82z+4+kcilO0Cwv9JCJXqmfP+6+gSDwuTXZQbnWQQbm97El5nMncGeIDZmGUu C2hHznhVZB4OeLjL/BdSDIund/YXfEKU/eeZQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714403103; x=1715007903; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gMpzOFCFY/OFyCB78Iqov2ITRER3c7lueX7XaC40UJk=; b=whSWuAWD9tLPtF50MyfCLeQN58su2MekYluZHrNwJweRchbO3z3u6omqcGm+pGp4TI tOpkYbdMOzkvlLkWHhts7LfXZ3e6+IZKkcomgQ+hdZsSWR4Wr69/o9DqGdgAkToYHv/C NJdgSbUNXW24OHRK0EmzCVMlktYa3zUEXiiHWdjxwoQmdfC9gggGfn+oNjgF6lQVCLGq 403QEl+8nZ7WA5Tuey3+yzOPO37dlFVxIw2r6n9GiYU4gcQzPlwOyGoQd/B+IO1OSg4C ZzyOtzCyJjF3PDnh2p2HKUWV7mcGQRe23i3Y7EoGMlzFv2VLOwgGRai9ZPXud8jiK99V Lk7Q== X-Forwarded-Encrypted: i=1; AJvYcCWS0jzvZZNU5zyuPQVkLnBdscQmsPBi2EdVukKiCUUPu8ftCMWW6BudU/7vhhNWOi48TiBPJI0vfIXMDqPlwsMG9BtNIDXmgUvW55S8IA== X-Gm-Message-State: AOJu0YwAoLC/eBkEtY73s/GZIt7XZFeR5q1TFmZcM8runMq7q1oVpllg gxEXsnmTPYjP03NkT1zMpOA+SUCi/z3AKMuhPN6kE3DVa/9s4HuB7mr6L02rew== X-Google-Smtp-Source: AGHT+IFhJl+kGtaYhV7Q9Gv3xiaVng6RdI8g6vF7vUpIJM3CzWksrp2O5EtILgQd8YzMcEQUTtUSrA== X-Received: by 2002:a05:6870:701f:b0:22e:d258:bc43 with SMTP id u31-20020a056870701f00b0022ed258bc43mr12416234oae.42.1714403103424; Mon, 29 Apr 2024 08:05:03 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id p7-20020a05620a056700b0078d3b9139edsm10568591qkp.97.2024.04.29.08.05.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:05:02 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:04:59 +0000 Subject: [PATCH v3 20/26] media: tegra-vde: Refactor timeout handling Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240429-fix-cocci-v3-20-3c4865f5a4b0@chromium.org> References: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> In-Reply-To: <20240429-fix-cocci-v3-0-3c4865f5a4b0@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hugues Fruchet , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Paul Kocialkowski , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Matthias Brugger , AngeloGioacchino Del Regno , Hans Verkuil , Sergey Kozlov , Abylay Ospan , Ezequiel Garcia , Dmitry Osipenko , Benjamin Mugnier , Sylvain Petinot , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 Reorder the branches a bit, so cocci stops complaining about the code. drivers/media/platform/nvidia/tegra-vde/h264.c:645:20-21: WARNING opportunity for min() Signed-off-by: Ricardo Ribalda --- drivers/media/platform/nvidia/tegra-vde/h264.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/nvidia/tegra-vde/h264.c b/drivers/media/platform/nvidia/tegra-vde/h264.c index 204e474d57f7..cfea5572a1b8 100644 --- a/drivers/media/platform/nvidia/tegra-vde/h264.c +++ b/drivers/media/platform/nvidia/tegra-vde/h264.c @@ -633,7 +633,9 @@ static int tegra_vde_decode_end(struct tegra_vde *vde) timeout = wait_for_completion_interruptible_timeout( &vde->decode_completion, msecs_to_jiffies(1000)); - if (timeout == 0) { + if (timeout < 0) { + ret = timeout; + } else if (timeout == 0) { bsev_ptr = tegra_vde_readl(vde, vde->bsev, 0x10); macroblocks_nb = tegra_vde_readl(vde, vde->sxe, 0xC8) & 0x1FFF; read_bytes = bsev_ptr ? bsev_ptr - vde->bitstream_data_addr : 0; @@ -642,8 +644,6 @@ static int tegra_vde_decode_end(struct tegra_vde *vde) read_bytes, macroblocks_nb); ret = -EIO; - } else if (timeout < 0) { - ret = timeout; } else { ret = 0; }