Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3794784rdg; Wed, 18 Oct 2023 06:25:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXazF3hJ99K5JQ319z9KSmO/NIdO7N8wcvW3dODFtVM8M4uhzxDxbn1xWM+wXoI8H+LFsm X-Received: by 2002:a17:90a:8a0c:b0:25e:a8ab:9157 with SMTP id w12-20020a17090a8a0c00b0025ea8ab9157mr4811933pjn.22.1697635524170; Wed, 18 Oct 2023 06:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697635524; cv=none; d=google.com; s=arc-20160816; b=aHSnmlI1ttpW9fPOoAQMdqUpYLisi4dmiQgP4cnPcsjaYRr2cZJstWff/vjT0OPmUI Yn/RchwaRPFAu9eIXjZcY01fn+/xaf47e6FSsLcbt+ZEW3RMQwT9A9JMwBgefy7Oq8Iw 8g6MA2N0ddZ2RO+VmfAKZX1tQ7K6Ojr5GIfoX4B0JltmagKfJgPi0NFqyXhf8MDOdsvv Wuz7fTpXuAtTVTV0Egsdc6D1E1TJk+5Mvu8WbMqORlcmPc4AK/iy8YD19uKGuXVicMjU kE4pdObnEXwmyLGJEF+Opbui6hYPaTn9aUejjQ/T/0Pu31AEz9YHKbeE5VtcKq3rP6JP XfUQ== 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=juPtE2Yid96AbzEzI/9Bqd2u/x1go6sSInM4krgNlSM=; fh=I/KMLkMDWcF1+fFfbcRMmhSzcNR1O2/dpfBKJ5hVHzQ=; b=DUdLldgEWiOOP8cj1t+QsCZlyfKUjlOarRMKcsbPmpmAPDjGZ0hr30DyucmBpw9TvL q5pcPO9E0Rcgi486eK2ydxFKDjoUKHVCMqZUbvjNqiHd2HdSbGXmpyn66AaPsIOrVTn6 Unfh7UN9NTX9i6Hed5jHhlCdladhDaiuUZPXdbGznV6fk+OBqaNB3QGQHbllMH4Gr/xj F0p1Z/G+N5wtwg0lM1PkmOlW7VdHXmiBjWAL/3pR3lczEA6pK7biWy8MxDk+YW3hA798 DJEJM263GZ8mOwWHTYaP2wgz9FlkI5k/G9YukiWCZ8vAclPm/SIIMretLHlwK8S6v5YW u5cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wXpnBUfd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id n3-20020a17090a9f0300b0026b31ed4895si1494939pjp.29.2023.10.18.06.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:25:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wXpnBUfd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8714C80295C0; Wed, 18 Oct 2023 06:25:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344549AbjJRNZN (ORCPT + 99 others); Wed, 18 Oct 2023 09:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231656AbjJRNZL (ORCPT ); Wed, 18 Oct 2023 09:25:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63796112; Wed, 18 Oct 2023 06:25:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C944C433C8; Wed, 18 Oct 2023 13:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697635507; bh=V5vV9mOcW/WM58qdgODI7jhGfII2OqW8maCTrvEpT78=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=wXpnBUfdo4YSW8EebR0dBdWP897om+17z8TLdTsIvE85A2YkJgrmJKX5oxVeyj2th Vn3lEdRfnHXpnpo4lnM7emSVpJ3OoQqo1uhxyaLLCsYZyjsuZOkic2iNK7Mh22t0aO RXb4u9P8FyD8//Upmwr+MTYwkllNRLj2dmQCv0WY= Date: Wed, 18 Oct 2023 15:25:05 +0200 From: Greg Kroah-Hartman To: Dorcas Litunya Cc: outreachy@lists.linux.dev, julia.lawall@inria.fr, dan.carpenter@linaro.org, andi.shyti@linux.intel.com, Sudip Mukherjee , Teddy Wang , linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] staging: sm750fb: Remove unused return value in program_mode_registers() Message-ID: <2023101830-janitor-trapezoid-bb48@gregkh> References: <492e63bbc58147fb534930ef9e1fb5d844ae8769.1697619623.git.anonolitunya@gmail.com> <2023101846-synopses-paralyses-d1ee@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 06:25:21 -0700 (PDT) On Wed, Oct 18, 2023 at 12:34:26PM +0300, Dorcas Litunya wrote: > On Wed, Oct 18, 2023 at 11:26:33AM +0200, Greg Kroah-Hartman wrote: > > On Wed, Oct 18, 2023 at 12:07:38PM +0300, Dorcas AnonoLitunya wrote: > > > Modifies the return type of program_mode_registers() > > > to void from int as the return value is being ignored in > > > all subsequent function calls. > > > > > > This improves code readability and maintainability. > > > > > > Suggested-by: Greg Kroah-Hartman > > > Signed-off-by: Dorcas AnonoLitunya > > > --- > > > drivers/staging/sm750fb/ddk750_mode.c | 5 ++--- > > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/staging/sm750fb/ddk750_mode.c b/drivers/staging/sm750fb/ddk750_mode.c > > > index 83ace6cc9583..e15039238232 100644 > > > --- a/drivers/staging/sm750fb/ddk750_mode.c > > > +++ b/drivers/staging/sm750fb/ddk750_mode.c > > > @@ -73,8 +73,8 @@ display_control_adjust_sm750le(struct mode_parameter *mode_param, > > > } > > > > > > /* only timing related registers will be programed */ > > > -static int program_mode_registers(struct mode_parameter *mode_param, > > > - struct pll_value *pll) > > > +static void program_mode_registers(struct mode_parameter *mode_param, > > > + struct pll_value *pll) > > > { > > > int ret = 0; > > > int cnt = 0; > > > @@ -202,7 +202,6 @@ static int program_mode_registers(struct mode_parameter *mode_param, > > > } else { > > > ret = -1; > > > > Why are you still setting the 'ret' variable if you are not doing > > anything with it anymore? > > > > > } > > > - return ret; > > > > Are you sure that the caller shouldn't be checking for errors instead of > > dropping the return value? If so, document that in the changelog too. > > > Seems like the caller doesn't use the function to check for errors as in > the code below: > > int ddk750_set_mode_timing(struct mode_parameter *parm, enum clock_type clock) > { > struct pll_value pll; > > pll.input_freq = DEFAULT_INPUT_CLOCK; > pll.clock_type = clock; > > sm750_calc_pll_value(parm->pixel_clock, &pll); > if (sm750_get_chip_type() == SM750LE) { > /* set graphic mode via IO method */ > outb_p(0x88, 0x3d4); > outb_p(0x06, 0x3d5); > } > program_mode_registers(parm, &pll); > return 0; > > It will still return 0 regardless of whether there is an error or not. > Since I am not sure how the two functions relate to one another, is > there need to check error in the caller function? That is correct, it is not checking for errors, but shouldn't it? If the function can fail, then it should have proper error handling so return the correct error (hint -1 is not a valid error), and then propagate it up the call chain correctly as well. For doing this type of work, either the function can not fail so there can not be an error return value, or it can, and then the error should be propagated correctly. Sorry for not spelling that out earlier. thanks, greg k-h