Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1307872ybb; Sun, 29 Mar 2020 01:09:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vupaZ8hMD+065Ua+trWVXyD8WFBYALqP+LIrWoEjCwQDEeeioKJONGUgiFeEyrwYHYIv9UW X-Received: by 2002:aca:ddc4:: with SMTP id u187mr4357905oig.129.1585469386391; Sun, 29 Mar 2020 01:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585469386; cv=none; d=google.com; s=arc-20160816; b=QpVj0gA24JfQqPO+Bx0TsIuIfAa0nrbeqSzGpv2L5FbmgDPCHIKCNDK/dXGzaU7C1+ JvwH8qFnJlGqmeBFp3WoXclsw6+t1wIg2W1sA6DkdHBe0tzpeHp5ZFGCIL6M26xAPCw2 qTVi+RUHEqpmhN/FxfbIYobSHh4e22F/HR2MxHZjfub/jkmKV9EaahqUQwJ/H8a6thiE dsGxS4o09BeAWAtVjq7OAHMthOXzruTm4NmK7VHOTK82/zDl1tpD3kT348nNS2u2HdK3 4oge9YP3p+nOHTf2ZSBNJXGjJ7BynZK9Rd02d9Tc0NL8jWovsfyjURo+ab++o3YR0KVj 6oHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=apW5rSuNNDXWAi3zkdCzNB2vya3XNVG81xLV1mUPG10=; b=hnMq2aQ6eG/YWw7Vw6ePGCyTlmcEXld0BxqZqm2OPOrSGwj49gTHQ0NG5Ci5OLEWb5 Xl2xp1qjxoV5pyoOYQUuabowYhuBEhZkCDiSCUP/bEGfEkOIAjV47wITICR/aLlgFy82 KWd9XJIBmjJmjteSzqft/VuL/2jVDiIWgX6ecitpDaAGwq/mbwFNCTFYNhFBlPeD+TFd HA1AV+xtswFtPaukQb/7d4FTn+VQigFBw6hb8t24q7oJjLeyIXLNKesJpRngj+6UztTv zWaaa92uyDqJ4ljs+iqFVsaPcTfi8Pn2tMrmketAiwOZuYYB47rdxW3pRnYj+J8hN09Y uVsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si4307158oig.223.2020.03.29.01.09.33; Sun, 29 Mar 2020 01:09:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727822AbgC2IEq (ORCPT + 99 others); Sun, 29 Mar 2020 04:04:46 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:46866 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726391AbgC2IEq (ORCPT ); Sun, 29 Mar 2020 04:04:46 -0400 X-IronPort-AV: E=Sophos;i="5.72,319,1580770800"; d="scan'208";a="442801596" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2020 10:04:44 +0200 Date: Sun, 29 Mar 2020 10:04:44 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: "John B. Wyatt IV" cc: outreachy-kernel@googlegroups.com, Julia Lawall , Stefano Brivio , Forest Bond , Greg Kroah-Hartman , Quentin Deslandes , Colin Ian King , Malcolm Priestley , Oscar Carter , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: vt6656: add error code handling to unused variable In-Reply-To: <20200329033435.498485-1-jbwyatt4@gmail.com> Message-ID: References: <20200329033435.498485-1-jbwyatt4@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 28 Mar 2020, John B. Wyatt IV wrote: > Add error code handling to unused 'ret' variable that was never used. > Return an error code from functions called within vnt_radio_power_on. > > Issue reported by coccinelle (coccicheck). > > Suggested-by: Quentin Deslandes > Suggested-by: Stefano Brivio > Signed-off-by: John B. Wyatt IV > --- > drivers/staging/vt6656/card.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c > index dc3ab10eb630..9d23c3ec1e60 100644 > --- a/drivers/staging/vt6656/card.c > +++ b/drivers/staging/vt6656/card.c > @@ -723,9 +723,13 @@ int vnt_radio_power_on(struct vnt_private *priv) > { > int ret = 0; > > - vnt_exit_deep_sleep(priv); > + ret = vnt_exit_deep_sleep(priv); > + if (ret) > + goto end; Normally, if there is nothing to clean up, one can just say return ret. > > - vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON); > + ret = vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON); > + if (ret) > + goto end; > > switch (priv->rf_type) { > case RF_AL2230: > @@ -734,13 +738,18 @@ int vnt_radio_power_on(struct vnt_private *priv) > case RF_VT3226: > case RF_VT3226D0: > case RF_VT3342A0: > - vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL, > - (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3)); > + ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL, > + (SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3)); > break; > } > + if (ret) > + goto end; > > - vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD); > + ret = vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD); > + if (ret) > + goto end; There is no need for the above if, because whether ret is nonzero or not, you will just end up at the next line. julia > > +end: > return ret; > } > > -- > 2.25.1 > >