Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2986405yba; Sat, 11 May 2019 01:02:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqycp28mqQkANSHtEzbRRfN344Qo860lupaGmhfk1Y9+vBOL3Eb73jzZB0WMXGZFOrEUgKtU X-Received: by 2002:a63:7141:: with SMTP id b1mr18895496pgn.331.1557561771299; Sat, 11 May 2019 01:02:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557561771; cv=none; d=google.com; s=arc-20160816; b=I8YKxxp3i/wIL99QTD/eacPcXI0gx6ls8js5isrxwYTJkRZmeb5vqIlrsGXS7GrmtW G8tLLJhwPLKuVm+JUlzIq0/UOVqThH7uOZ3hMEcoPtUv6iqe9IyBearFeW0tnlS1p7GZ zt4f5Rwoni05m+31Bogr4zA8GEsaTafIPK0pJb4Uey7eQkjXyrXPD20g9ga/m2ivBmCs 8LQc5AL6nLcvPgSuSTEYX296NrBKZTAJVRIU6C0ApqrI7K6DKHOT926iR19yiCj2mnM3 VcdXLmeWuYgGHekwiSHoyuK9sLl5OsW89e7h1C9dStda28It3JZIXVlRAmX0PQwzBed5 Uujw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :from:date:dkim-signature; bh=uQaA5fcRvs5IaqVA9AoxeTKiHpRpWKn2OxP1/dwsWz4=; b=uUakk9KhXGxLTz7FV6z+k9frtTPgh/gxvYp3DufnMDWxZJQUBNDMn8XvSlNEF+F2D8 PSQ5L1RkH/TVfT+2Gv4uZwTA6l37Q8w8xaxk/KfcY9VR+StipC3v0BM26BLN41XuOp2k zQupopp/Ql8h7tkEpjgBX1lF1FXx8CWC8ukj4YdFo9xIDxEb1bkv7unBaEjQGnOQxx7H 7Fse+Z9n8f23CyMEzcX+PUZRxevgQga0V3xPtIA0Pum3Hh+1zaByXULQ5xVFqTXu+TBY CqdwUPF24dQ3SsEkvoRgqdISTTJmFXkl8BnB2JW5v72fecI1U26xJtSa1K5WV7drTxye VUTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Up8YnEAF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15si9831293pll.40.2019.05.11.01.02.06; Sat, 11 May 2019 01:02:51 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Up8YnEAF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728438AbfEKH6U (ORCPT + 99 others); Sat, 11 May 2019 03:58:20 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45451 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726849AbfEKH6U (ORCPT ); Sat, 11 May 2019 03:58:20 -0400 Received: by mail-pg1-f193.google.com with SMTP id i21so4113814pgi.12 for ; Sat, 11 May 2019 00:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uQaA5fcRvs5IaqVA9AoxeTKiHpRpWKn2OxP1/dwsWz4=; b=Up8YnEAFqQ27j6vsFXS8mDUMbFQj58WAXF+diuSBBfP5dtRoqjcP8pbM0d/BszKOx4 rhLH88f2b+O3GXwVWOwMwcNm2sbkzash9yuEPgUIMwmKNexrQW+GoOnt8yHHmfoj7wCB yDWmiJYAsXHISW5+N9TTLGbWKIPI7VALac9J78ycqsn1SYHPJII6C8ZkUAaZAeAm7UNl /cUP0si1Khgzdx+1tTSUCyjbpZeZ60JR7SWJoBiUgs8fUecrHbybefAV4CJ7O29NhKxa 2phmZE9LRgIX/b934HiGE7NrFBYW2GdXKCKWLaI1q8Mx5epjKX7dA13yY7mfJD5bPKGR UpXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uQaA5fcRvs5IaqVA9AoxeTKiHpRpWKn2OxP1/dwsWz4=; b=cB2rILxlANOVVYnWxMk3Wwjx6jOq/IqSnUBicwstoahJH+hg/ZGp3/heq9qZAEJrzj CMhEW2+xFyWatBExhM4ccBAEGtH5jNZ9JX0suIMzUOxn5cAYzXJjkpJsa48APcKUhggs lyJfQyX2RGz7GvE2vvnFIThZRppY8ROfvxHihpjf8CfhPzbFAhBlQKifgsPwUrwAEIhG lwi8CdPlwJ4J+G6NRABS/KEORpamPdIxW+KIKxrXyB6sOZ7YLfkdPKL0TW3czL16o+dw VYUKRiQ7aVNN722Ugv05nx42OwHrRmtL5UdVgU+za0ymWmsLH4ZJJx5fzPnsx/KpTOex YU8g== X-Gm-Message-State: APjAAAWwe5fsh+ek0LzuzSqG8oCDMCr+bMVtxX3WShUoeiinD6nHl6vY LfXQosqhcqEDgNIbl3Lw2d8= X-Received: by 2002:a62:6f02:: with SMTP id k2mr20548059pfc.136.1557561499736; Sat, 11 May 2019 00:58:19 -0700 (PDT) Received: from hari-Inspiron-1545 ([183.83.92.73]) by smtp.gmail.com with ESMTPSA id c14sm7970466pgl.43.2019.05.11.00.58.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 May 2019 00:58:18 -0700 (PDT) Date: Sat, 11 May 2019 13:28:13 +0530 From: Hariprasad Kelam To: Dan Carpenter , Greg Kroah-Hartman , Tim Collier , Chris Opperman , Hariprasad Kelam , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: wlan-ng: collect return status without variable Message-ID: <20190511075813.GA17352@hari-Inspiron-1545> References: <20190510023900.GA4390@hari-Inspiron-1545> <20190510105754.GA18105@kadam> <20190510172308.GA3075@hari-Inspiron-1545> <20190510184011.GE18105@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190510184011.GE18105@kadam> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 10, 2019 at 09:40:11PM +0300, Dan Carpenter wrote: > On Fri, May 10, 2019 at 10:53:08PM +0530, Hariprasad Kelam wrote: > > On Fri, May 10, 2019 at 01:57:54PM +0300, Dan Carpenter wrote: > > > On Fri, May 10, 2019 at 08:09:00AM +0530, Hariprasad Kelam wrote: > > > > diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c > > > > index 8a862f7..5dad5ac 100644 > > > > --- a/drivers/staging/wlan-ng/cfg80211.c > > > > +++ b/drivers/staging/wlan-ng/cfg80211.c > > > > @@ -231,17 +231,12 @@ static int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev, > > > > { > > > > struct wlandevice *wlandev = dev->ml_priv; > > > > > > > > - int err = 0; > > > > - int result = 0; > > > > - > > > > - result = prism2_domibset_uint32(wlandev, > > > > - DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID, > > > > - key_index); > > > > - > > > > - if (result) > > > > - err = -EFAULT; > > > > - > > > > - return err; > > > > + if (prism2_domibset_uint32(wlandev, > > > > + DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID, > > > > + key_index)) > > > > + return -EFAULT; > > > > + else > > > > + return 0; > > > > > > We should just preserve the error codes from prism2_domibset_uint32(). > > > > > > return prism2_domibset_uint32(dev->ml_priv, > > > DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID, > > > key_index); > > > > > prism2_domibset_uint32 function can return -ENODEV,-EPERM,-EBUSY if > > fail case. > > > > If we observe the pattern of calling this function,we can find > > > > "return -EFAULT on failure and 0 on success". > > > > Due to this we can not collect return status directly. > > Yes, I know this code is full of nonsense. > > It shouldn't just always return -EFAULT, it should preserve the correct > error code. This is only called from rdev_set_default_key() if you want > to check the caller. > > regards, > dan carpenter Yes , Caller not particular about -EFAULT,there is no need of masking all errors with EFAULT in fail case. We can directly collect the return status. Will resend the patch with suggested changes Thanks, Hariprasad k