Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp300806pxj; Fri, 7 May 2021 08:54:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKyVIIna2ycYZtttG7tmgmNN5Tyt2YHxkncN2+D/lPM5y/sqRxyqd7Va8WHmZRg/OZUVks X-Received: by 2002:a17:906:a44d:: with SMTP id cb13mr10547931ejb.107.1620402890061; Fri, 07 May 2021 08:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620402890; cv=none; d=google.com; s=arc-20160816; b=tZ8zI26P7E5Di4tsmTe43z7h9+/74UGatcc8ywKSNtF6MEozFGma/Pt5ew0JDeeQyc T+SVvaq7vUMfpE0r6uDeD2cpGJ9cpPY0rLVrB6nrr6b1qVU11GsekpYROFbnYjw+kefB e050PBs2AtGYPSCx7cvhfintviUh4KmEosi4u37QjfHGTw/kEfjLe4n5d9SG1lFfjYRX 4H7x7gStN+GzL/udn7BbuF6v3C4Lka1HxsxGsPphuoGTbTAixIS6GloNWsP1OOtGbaIP z790PmNz7GQH9NevAF1pxwFVa6sRLw5R3eS9JMj30Hp+JDmTXtSbuJb6HmcAPJWLMjTX V93g== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZOmsg+YamYJPSjeRVsW3Marq8AjAD33trE3+j0/kd7Y=; b=NxlsRKLMryCTjsuJykGn1DhsmV7aZZUujdQKGB/9qMK7Rh1va+ReWEl2yAGS40Pkyy 71E5V3Bd/HcXugG+c6/CeBNggngGPHoBfzUa8vMYKKf9uNL/x2oC1ghbwdIZ43EQ8QmF zVhmZMkczmxLOhiPpSihUW8aNQlY9dPGap1GHmP0qhtyRAtMCma/QoUSgawezW/l9oTH Srns0Y6UNrWz1LpH116jZj+otyCcV/Buy+KOHzpscjuZSP6hOxkXVz6UZKB9oW/g5y3F 81hoFEsa8P7PM8AnevKIRbIqhA57f55iaprenCLwZPXx9MYThnQm4VU1zKLr+LjUyn2U aCIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dIh4wS9H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si2670278edt.197.2021.05.07.08.54.24; Fri, 07 May 2021 08:54:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dIh4wS9H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236269AbhEGMSA (ORCPT + 99 others); Fri, 7 May 2021 08:18:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:46732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhEGMR7 (ORCPT ); Fri, 7 May 2021 08:17:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 52F136100C; Fri, 7 May 2021 12:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620389820; bh=kAX2q89zUtg6sddYFznN3zI0usUIbWNAgbcEr0LdgvY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dIh4wS9Hf68ZridKp3QQ+6CswDF7lqGkm/LgDp5KYMHEUl6Miv1rpxCz41sOWurl6 llgRXoYMhIlGKMTxnTM3o+O4pfSDsUR/apxe2/RTdAQDhOv+tRI02zA4/E9VDoeUZo SkLUZv5PzaasJOvguVe/lrbC30Aw52z92ITjbOzs= Date: Fri, 7 May 2021 14:16:56 +0200 From: Greg KH To: Anirudh Rayabharam Cc: Matt Porter , Alexandre Bounine , linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] rapidio: fix unused variable warning in rio_cm.c Message-ID: References: <20210506181837.4758-1-mail@anirudhrb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 07, 2021 at 05:35:48PM +0530, Anirudh Rayabharam wrote: > On Fri, May 07, 2021 at 08:39:21AM +0200, Greg KH wrote: > > On Thu, May 06, 2021 at 11:48:36PM +0530, Anirudh Rayabharam wrote: > > > GCC produces an unused variable warning for 'rc': > > > > > > drivers/rapidio/rio_cm.c: In function ‘rio_txcq_handler’: > > > drivers/rapidio/rio_cm.c:673:7: warning: variable ‘rc’ set but > > > not used [-Wunused-but-set-variable] > > > > > > The return value of rio_add_outb_message() is assigned to 'rc' but it > > > is never used. Fix this warning by logging an error if 'rc' is non-zero. > > > > > > Signed-off-by: Anirudh Rayabharam > > > --- > > > > > > Changes in v2: > > > Log an error instead of just removing 'rc'. > > > > > > v1: https://lore.kernel.org/lkml/20210501055018.9244-1-mail@anirudhrb.com/ > > > > > > --- > > > drivers/rapidio/rio_cm.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c > > > index 50ec53d67a4c..971a36f1a23a 100644 > > > --- a/drivers/rapidio/rio_cm.c > > > +++ b/drivers/rapidio/rio_cm.c > > > @@ -677,6 +677,11 @@ static void rio_txcq_handler(struct cm_dev *cm, int slot) > > > cm->tx_buf[cm->tx_slot] = req->buffer; > > > rc = rio_add_outb_message(cm->mport, req->rdev, cmbox, > > > req->buffer, req->len); > > > + if (rc) { > > > + riocm_error("Failed to add msg to tx queue (err=%d)", > > > + rc); > > > > That's pretty pointless (and no need for {}). > > The point is that this fixes the compiler warning. Don't blindly fix warnings in ways to just shut a compiler up. Fix the issue correctly please. > > If an error happens, properly recover from it, don't just punt and tell > > the user something bad happened and then ignore it. > > The primary motivation behind this patch is to fix the compiler warning. > This error is ignored even in the current tree. My patch at least logs it > so that people know that it's happening. And once they know that it's > happening and someone wants to propagate the error code to userspace or > handle it differently they can write a patch to do so. Please write that patch, as-is, this change is pointless. thanks, greg k-h