{"id":2222445,"url":"http://patchwork.ozlabs.org/api/patches/2222445/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-tegra/patch/20260411211006.150782-1-hossu.alexandru@gmail.com/","project":{"id":21,"url":"http://patchwork.ozlabs.org/api/projects/21/?format=json","name":"Linux Tegra Development","link_name":"linux-tegra","list_id":"linux-tegra.vger.kernel.org","list_email":"linux-tegra@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260411211006.150782-1-hossu.alexandru@gmail.com>","list_archive_url":null,"date":"2026-04-11T21:10:04","name":"[1/2] staging: media: tegra-video: fix wrong return type in tegra_get_format_fourcc_by_idx()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"6d63341e3d429e00bfb8f8b3699f6221b31605f8","submitter":{"id":92777,"url":"http://patchwork.ozlabs.org/api/people/92777/?format=json","name":"Alexandru Hossu","email":"hossu.alexandru@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-tegra/patch/20260411211006.150782-1-hossu.alexandru@gmail.com/mbox/","series":[{"id":499574,"url":"http://patchwork.ozlabs.org/api/series/499574/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-tegra/list/?series=499574","date":"2026-04-11T21:10:05","name":"[1/2] staging: media: tegra-video: fix wrong return type in tegra_get_format_fourcc_by_idx()","version":1,"mbox":"http://patchwork.ozlabs.org/series/499574/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2222445/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2222445/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-tegra+bounces-13711-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-tegra@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Ixj8ZSCf;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-tegra+bounces-13711-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"Ixj8ZSCf\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.208.48","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ftRDs5SDqz1yGj\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 12 Apr 2026 07:11:41 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id DB1BA30134BF\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 21:11:37 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id BC1793BF680;\n\tSat, 11 Apr 2026 21:11:37 +0000 (UTC)","from mail-ed1-f48.google.com (mail-ed1-f48.google.com\n [209.85.208.48])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B2B21DDA24\n\tfor <linux-tegra@vger.kernel.org>; Sat, 11 Apr 2026 21:11:34 +0000 (UTC)","by mail-ed1-f48.google.com with SMTP id\n 4fb4d7f45d1cf-66e6d9610d8so4484927a12.0\n        for <linux-tegra@vger.kernel.org>;\n Sat, 11 Apr 2026 14:11:34 -0700 (PDT)","from ahossu.residents.sin.openfiber.nl ([88.202.160.248])\n        by smtp.gmail.com with ESMTPSA id\n 4fb4d7f45d1cf-670702eec8asm1511110a12.2.2026.04.11.14.11.30\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sat, 11 Apr 2026 14:11:31 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775941897; cv=none;\n b=TYWus961ce2I1oWzv+S3w5yCATBo9CiMrcylglguQY01MPqP1Bc2RI+eYvikoNvooq5lzFT0IFnaaUwbArNDqW5QJA2GtPTCPFY88Valf2WeibxYzq5dCGpwKhRlil5FBM9Ddmw2ER5a+zQ2BGtlOMR1Tbp2VSgu7lIQj9xOQxE=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775941897; c=relaxed/simple;\n\tbh=gi15hcyqfgdadvIhdvu5Qn7qP7o4w4fImY4nXxFjqQc=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=DgHNohPZw7y1TcHrlwl+VTWVQpZqxijr5VLKpBj0S9N1WxS7WdX/O7/tW9UwJc7/EkYHukMGq6WRJoIUWa2agK2U/ScTvdQinmMeH3Xvtf5fg1XmSAFJlJl6YfjhS1ff6fWtQgI7jc1znsE4Urva2eqifCzzTZCwqJC7NSkn/w4=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=Ixj8ZSCf; arc=none smtp.client-ip=209.85.208.48","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1775941893; x=1776546693;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:from:to:cc:subject:date:message-id:reply-to;\n        bh=7sJmPJWyRpJ6XpOWhqHf2lRa3H2nAMFw7nJfxUU+y3o=;\n        b=Ixj8ZSCfh9qoyLBz05ac4nnJJeza7KmqAD8wV816BmzFZN5hwn0CqobIIF3Z98nPJQ\n         d1mFxY/boyPEG3/fpS0fr7OP7ltIrnVm5S/rVPX5MuYVZs+97JXkES534wjObAWrxSln\n         Edh3zs2miqDRGa0YcYp6EwEbP3d8dtRAzrtUtiGDbInT9xqR1NrcQ9DKgCJdYY4SNjfe\n         woVUlpP6RCizXf0wRfvel6Aa2MKCl+SekvcNN8ujiz+UUjqlUGiO+s2Y7bZbFrURi9ds\n         9141oz4vBiZoAJt7h7PATVjpKTijn+//SmhG5UOkkfxv0grMEEaOtcYFamnGcM4fgfJA\n         Jyiw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775941893; x=1776546693;\n        h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=7sJmPJWyRpJ6XpOWhqHf2lRa3H2nAMFw7nJfxUU+y3o=;\n        b=tVqAB+VKDkviyuvqO89YqbNPIU0TKReseb0G4QJC2UOEq6zFR3jCzbggqBn1+WuJP5\n         d21cMD4+vcHSkIAdU910iGOepJjVm0F6UDT6vyTz/PmdnxiodIYjjVuVtxEHqyEPX31R\n         Pm3uvdeIaUxODq3CvMO6yx+QplsjE36HCmkHbfDBalC0n/zbdjnRqnBOYMXQS+CNxz/O\n         43seN34HJYwOlo7KDPdE5jZ6IuP5K+U9E37tDLcX74bYPC79Jt1d4HaOHXDmBZ04poEH\n         uFw3Un/QVGx0yuVnbQ1UTKeohmh875/FLnG+Z31PiI0cupWq+gbthBN0zGyRLpSqZwQR\n         OLRQ==","X-Forwarded-Encrypted":"i=1;\n AJvYcCUfUc+bfbKodDhQOLgegfxrBpwmsAF8xhfKU1vjcSF2toqGJLCd6MaHFFUXmAMqMGd6T+IFrs8Ks8iiFQ==@vger.kernel.org","X-Gm-Message-State":"AOJu0YyWC5kC28Zhta0C1DV31g+ZOi/sf+2MCEsVMf2s4/pj0SP6OrHR\n\tA0aQFLu5YfxtQ+IwxdWlvHXtToh/+Txh5xneLouN3e0RefFIjVr+acrF1l9HsslC8SE6Ug==","X-Gm-Gg":"AeBDieukorz1JzfnAZTX/Ij+3H60DXkbQ9boCChI0MLXVnJBOtjVLq2FYfxcNJgq4us\n\tmU1714cHTN6vSyA478YUh84aibssYp+vQLev7I918uPYYvQjYQX1LEEhUzpKFDCREY2njgRow/u\n\t/TVke6zh0JDfgYx20zBMMe97qQZ3dR9j6Pp8XI2KDRpMH79zb6GnZH1iICINZM4YpM5Z6fT97zk\n\tjrjxjaJrDSr4+SbAYcvZvhFlqPbuxhMhHu52purGCWua70pnTk6NIFU/Q5LQ37caQXb5NlsBueL\n\tji5gaN8LU9XDJCLOKHw8LnjdSERLTz1a83z/9DrNBq9H1RAbnNqsroRAXholIMDTzgxNzNqcgRf\n\tAmrXvUYAcpDGkcHSj2NjRnGaPC2uswTQ4Qa9fhjYxXawX2NwG87prGxRlC4ReBSONVMzioKe5wJ\n\tx55N9b95OqRMSPO3lZ/55SbKuib2vl0tsjsqmM4wtHrs7kqj7Mhu861gWisPtncjMrKuxnX65lP\n\tgOLYeFrbcwMtc4cqConb3bAIVhvj3wliekknoPeHqG6dAIkbIfnuD8jtbW18A8r72gYY6ueM5mK\n\tjdGzcw==","X-Received":"by 2002:a05:6402:280c:b0:670:64fd:2301 with SMTP id\n 4fb4d7f45d1cf-670795162d8mr3722324a12.15.1775941893193;\n        Sat, 11 Apr 2026 14:11:33 -0700 (PDT)","From":"Alexandru Hossu <hossu.alexandru@gmail.com>","To":"Thierry Reding <thierry.reding@gmail.com>,\n\tSowjanya Komatineni <skomatineni@nvidia.com>","Cc":"Jonathan Hunter <jonathanh@nvidia.com>,\n\tLuca Ceresoli <luca.ceresoli@bootlin.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\tlinux-media@vger.kernel.org,\n\tlinux-tegra@vger.kernel.org,\n\tlinux-staging@lists.linux.dev,\n\tlinux-kernel@vger.kernel.org,\n\tAlexandru Hossu <hossu.alexandru@gmail.com>","Subject":"[PATCH 1/2] staging: media: tegra-video: fix wrong return type in\n tegra_get_format_fourcc_by_idx()","Date":"Sat, 11 Apr 2026 23:10:04 +0200","Message-ID":"<20260411211006.150782-1-hossu.alexandru@gmail.com>","X-Mailer":"git-send-email 2.53.0","Precedence":"bulk","X-Mailing-List":"linux-tegra@vger.kernel.org","List-Id":"<linux-tegra.vger.kernel.org>","List-Subscribe":"<mailto:linux-tegra+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-tegra+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"The function is declared to return u32, but returns -EINVAL on the error\npath. Due to implicit conversion, -EINVAL (-22) becomes 0xFFFFFFEA as u32,\nwhich is an invalid V4L2 pixel format value.\n\nThe caller tegra_channel_enum_format() assigns this garbage value directly\nto f->pixelformat and returns 0 (success) to userspace via VIDIOC_ENUM_FMT,\ngiving applications a silently wrong format descriptor instead of an error.\n\nFix this by changing the return type to int and propagating the error\ncorrectly in the caller.\n\nSigned-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>\n---\n drivers/staging/media/tegra-video/vi.c | 11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)","diff":"diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c\nindex 9c0b38585d63..afc7327ef318 100644\n--- a/drivers/staging/media/tegra-video/vi.c\n+++ b/drivers/staging/media/tegra-video/vi.c\n@@ -77,13 +77,13 @@ static int tegra_get_format_idx_by_code(struct tegra_vi *vi,\n \treturn -1;\n }\n \n-static u32 tegra_get_format_fourcc_by_idx(struct tegra_vi *vi,\n+static int tegra_get_format_fourcc_by_idx(struct tegra_vi *vi,\n \t\t\t\t\t  unsigned int index)\n {\n \tif (index >= vi->soc->nformats)\n \t\treturn -EINVAL;\n \n-\treturn vi->soc->video_formats[index].fourcc;\n+\treturn (int)vi->soc->video_formats[index].fourcc;\n }\n \n static const struct tegra_video_format *\n@@ -395,6 +395,7 @@ static int tegra_channel_enum_format(struct file *file, void *fh,\n \tstruct tegra_vi_channel *chan = video_drvdata(file);\n \tunsigned int index = 0, i;\n \tunsigned long *fmts_bitmap = chan->tpg_fmts_bitmap;\n+\tint ret;\n \n \tif (!IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))\n \t\tfmts_bitmap = chan->fmts_bitmap;\n@@ -405,7 +406,11 @@ static int tegra_channel_enum_format(struct file *file, void *fh,\n \tfor (i = 0; i < f->index + 1; i++, index++)\n \t\tindex = find_next_bit(fmts_bitmap, MAX_FORMAT_NUM, index);\n \n-\tf->pixelformat = tegra_get_format_fourcc_by_idx(chan->vi, index - 1);\n+\tret = tegra_get_format_fourcc_by_idx(chan->vi, index - 1);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tf->pixelformat = ret;\n \n \treturn 0;\n }\n","prefixes":["1/2"]}