Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp446264rdb; Thu, 2 Nov 2023 08:10:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE81ReaqF51xew0QHMywxpOYhCBicjqRY7OkqXrz8FgMW5wzWSc/mrGwb00IxwugGF1pacM X-Received: by 2002:a17:902:f1d1:b0:1cc:2456:c17a with SMTP id e17-20020a170902f1d100b001cc2456c17amr11531836plc.33.1698937817742; Thu, 02 Nov 2023 08:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698937817; cv=none; d=google.com; s=arc-20160816; b=oDQiayCUsVTeJXWIkHu80jYzaHNUlYt+ZO1IwIkEBVmqy33DTnVIx/cS9tzucIqqeC tGjYUXo7PcWgTXtkbmgUX6lvb0Yi9CeXXn6SvqQXvNhN8QwulWFk01PiWawxpjPLAfY6 mtWiFXJspU2eLLc5YPntoSCcMohDN144rQHu54eIm+Y5/3ZCNY3NUHa8KspyPDBgd8pJ iBVHH88ILH1mUEqNrvojMRZ7DG9gezY0u6M5p9VG3AS57xgEFqnjPWfBE5VOEVTDt5Zu BP7MgCimaEPtPYlH0UUT1pavt6EZwyZwPqbDUvlurGIgurGTJRK9VJRw5trIYApUqSuH GTDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qJBlKJWh1zeSzz2XzQEe2J5vKtdGI3B3NMnTn9BC80k=; fh=tQiDCyUuE4bbgVjiWNCDemqZpLsNjCxtPL3MZONmGAw=; b=OWsuCCZGc72EXqZNNdoxULj3B2ePXZ3427Gnibyl1emSj/7J2roCtQ4IHd8cLz2tNU UMjfyoRF6qg0VMj7uMoHCo+ZPuGKX7l7pbm+2cD9+2DjiECnBHmzhn85prS0D66R9YoW yC0vKLY46Ad/Q683SFkIVSeONMIdfKS5e7uoyrvB4p/4wXJdF6LxdXf5G/NZHTPebrUx BFvtfuqVrRKpW92p0OKl/YGbd/uLKjy1VbhNy1HKj9MQzai181cCcJMdihZ1B+2gtuIj dIpY57WkFY/CbCqIZ7W5yLWEDvez+Zx/4Dxijr8OHKjrFw/3VQ4p8k+d/ycRwRmWCJqB RLHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hvKZm6mt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id o18-20020a170903009200b001c3a06b4fd7si9064pld.561.2023.11.02.08.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 08:10:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hvKZm6mt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 278AE822D01D; Thu, 2 Nov 2023 08:10:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232710AbjKBPKN (ORCPT + 99 others); Thu, 2 Nov 2023 11:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjKBPKM (ORCPT ); Thu, 2 Nov 2023 11:10:12 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5220B136; Thu, 2 Nov 2023 08:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698937803; x=1730473803; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=OHXfFQUZrtxpJ0p07bl7b5tBSPqCYpJ5LYV/rngT7UA=; b=hvKZm6mt3DN+zYBxwJziRQUKN9iDCQcIiBdjuLrQjJLup1zgpp0/jvFD mtYY8t4d1WGrD6i+zYCtzsUa37yFdMj2ecWR47sLiVuM44AlbKzaaVEEp qoRYr/jTjUt2n2xgrT1fpKDiWb/MU+Tm9qPX/0NsnKdTwvCCXEAstRhdc ocM2oS6y6z0oT4+vrjc+7xuBfqYkeZoLmcuLyu4KcpXcYFTGIqSh/ywuu QdIDcNIjkSSMoWds4cGwmc9BTqTqN7xWdigml/R7ol5F04FTawIuHdhMG cl6AQbPtjQcChAgtQkBVYSacAQXpO07+o0yk/1BM/XxnF2tDg6eyipzH1 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="474975213" X-IronPort-AV: E=Sophos;i="6.03,271,1694761200"; d="scan'208";a="474975213" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 08:10:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="851939601" X-IronPort-AV: E=Sophos;i="6.03,271,1694761200"; d="scan'208";a="851939601" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 08:10:00 -0700 Received: from kekkonen.localdomain (localhost [127.0.0.1]) by kekkonen.fi.intel.com (Postfix) with SMTP id B775711F929; Thu, 2 Nov 2023 17:09:57 +0200 (EET) Date: Thu, 2 Nov 2023 15:09:57 +0000 From: Sakari Ailus To: Hans de Goede Cc: Alexandra Diupina , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andy Shevchenko , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH 1/4] Remove redundant return value check Message-ID: References: <20231102141135.369-1-adiupina@astralinux.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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, 02 Nov 2023 08:10:14 -0700 (PDT) Hi Hans, Alexandra, On Thu, Nov 02, 2023 at 03:21:04PM +0100, Hans de Goede wrote: > Hi Alexandra, > > On 11/2/23 15:11, Alexandra Diupina wrote: > > media_entity_pads_init() will not return 0 only if the > > 2nd parameter >= MEDIA_ENTITY_MAX_PADS (512), but 1 is > > passed, so checking the return value is redundant > > Generally speaking functions which can fail should always be > error-checked even if their invocation today happen to be > such that they will not fail. > > Either the invocation or the function itself my change > causing it to fail in the future. Which is why we want > to keep the error checks. > > But maybe media_entity_pads_init() is special and > does not need to be error checked. > > Sakari, Laurent do you have any opinion on this ? > > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > This feels like a false positive of the tool to me, > but lets wait and see what Sakari or Laurent have > to say. I agree with Hans: this function today may not fail with the parameters passed to it but it may happen in the future. In general it's good to check a return value of a function that returns one: if that function is changed, no-one will go through the callers as long as the arguments and the return value remain the same. -- Regards, Sakari Ailus