From patchwork Mon Apr 15 19:34:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13630522 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 00D3415AD89 for ; Mon, 15 Apr 2024 19:34:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209679; cv=none; b=Z1uyebTJS1GES0pl1CzHCy5trlfOQRXVBsJRearrj65RI6CRYm1Mxer5bJAUaoDMFf26Zt4Llw8E+7B1jb0YLj+TVO7/dmRNobj068AhemgMOlxF5rTgnHrfrlzQXDIZ8KFgSibkE/1kD+koDXIm4BVaeQsIKVfgph7CefRIuOE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713209679; c=relaxed/simple; bh=NnOHj16PJj1bni+SNvuNVuvXN63e8NKQOBdaXLcKwbs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cLhkm70NEnXJgc205Pc/+t2ZxOHoAP8KzomoAx92eIBZMLt1KnUMPXkiN7Ey5aqQ7nBZBIIVz54QfxRInXPLQVkRmbitmPuurMffv6g3wo7lWf8nin5bIdddMsXTmFwFNuC9Q/f0U6JPhOgVwziGMxQzjBZPb56hlRVKE98DIWM= 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=lAJYAyUx; arc=none smtp.client-ip=209.85.222.170 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="lAJYAyUx" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-78d677dca70so270872885a.0 for ; Mon, 15 Apr 2024 12:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713209677; x=1713814477; 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=bek9HrODBg0M3bgnVqO/LKhPssOu/ibs61pEEfKBgdM=; b=lAJYAyUxo5riS0FArLbetp4a3tYm8T9UHi0nYdQ/AR5gr+vCiLxqT5bS7dJVJIemeV lsZD9YWhn7+XN6Pe9FBG0a74dcIAQLXuyBb6OL1Fiy7RK7zEKtD7OWYoQ6C7GmyAx+P7 suqS5lmIC46JseRrYQS+4OVk9CDmVXKDHzKVE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713209677; x=1713814477; 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=bek9HrODBg0M3bgnVqO/LKhPssOu/ibs61pEEfKBgdM=; b=O/aLhlcWYhiPi5AJTiKLFI8bIRRHXaXMRf4WWrWTE7xJBAoBg4yvHEG4Waj3+7YoMC xo8hWs1DfIwfrWbiNKxwbBRK6EM7PIX0FTIyCoE5WeRurxcKfwwDvSVRuE+zGoXYjMFH aqZ6L9zEO0fI43SrCn5dqqcFyM63b8r6GPleuFxCyfjmhmoPQMKuhtIz1M1lZzJrUM97 m4r2ufNPEgLa/c9JcO1AGlLo0WvqcmQm1Qt4TmNKc5/dsltRsv4p1Y4YVKZuUHYwva7+ NYLePqA+vOd9elin/cWmbe0x6RCg1RU4GqZmGb1zZt56sovgGNqSp360IL0yJ9KNhAUN lJ6g== X-Forwarded-Encrypted: i=1; AJvYcCXR32aQ/ww2YsQX9m7Mg+Ga53qU80nGYZiMKk49n5A+atPb0yQeaUqQIHiQ+1iB23O6hf+wQMLE/sTUCYwGS/oG0r8jdXnjB65yTqaHbw== X-Gm-Message-State: AOJu0Yxd4FjKx7QJHxCvhTTt6v5wWR0dBldOpE+0Kx4ZbMVf2H0pur6r y8wxJRUKCvrx7iw2LvW8PGHFP0RNWOzKX491h/XgMsxtnoM7sbBPdjEHjAl/4Q== X-Google-Smtp-Source: AGHT+IGdkApYbK4mkbCfGsE7agdP/ocKeSLQEP1wZl23ZOICtEnIFWB9MCiZP2rFcKrIOjZRFtHqpA== X-Received: by 2002:a05:620a:611a:b0:78e:e035:e898 with SMTP id oq26-20020a05620a611a00b0078ee035e898mr4919595qkn.75.1713209676753; Mon, 15 Apr 2024 12:34:36 -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 s26-20020ae9f71a000000b0078d3b54eb76sm6718055qkg.78.2024.04.15.12.34.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 12:34:36 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 15 Apr 2024 19:34:26 +0000 Subject: [PATCH 09/35] media: v4l: async: refactor v4l2_async_create_ancillary_links Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240415-fix-cocci-v1-9-477afb23728b@chromium.org> References: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> In-Reply-To: <20240415-fix-cocci-v1-0-477afb23728b@chromium.org> To: Martin Tuma , Mauro Carvalho Chehab , Laurent Pinchart , Hans Verkuil , 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 , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Bjorn Andersson , Konrad Dybcio , Benjamin Mugnier , Sylvain Petinot , Jacopo Mondi , Kieran Bingham , Laurent Pinchart , =?utf-8?q?Ni?= =?utf-8?q?klas_S=C3=B6derlund?= , Pavel Machek 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 Return 0 without checking IS_ERR or PTR_ERR if CONFIG_MEDIA_CONTROLLER is not enabled. This makes cocci happier: drivers/media/v4l2-core/v4l2-async.c:331:23-30: ERROR: PTR_ERR applied after initialization to constant on line 319 Signed-off-by: Ricardo Ribalda --- drivers/media/v4l2-core/v4l2-async.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 4bb073587817..e26a011c89c4 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -316,9 +316,8 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier); static int v4l2_async_create_ancillary_links(struct v4l2_async_notifier *n, struct v4l2_subdev *sd) { - struct media_link *link = NULL; - #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) + struct media_link *link; if (sd->entity.function != MEDIA_ENT_F_LENS && sd->entity.function != MEDIA_ENT_F_FLASH) @@ -326,9 +325,10 @@ static int v4l2_async_create_ancillary_links(struct v4l2_async_notifier *n, link = media_create_ancillary_link(&n->sd->entity, &sd->entity); -#endif - return IS_ERR(link) ? PTR_ERR(link) : 0; +#else + return 0; +#endif } static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,