Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4550215ybb; Tue, 7 Apr 2020 09:35:58 -0700 (PDT) X-Google-Smtp-Source: APiQypL3F6981CHkOVePHAuGK/w6aZMymBwnL5h099qDgRgMBSMqeRVeR3lLEDSuNSbH5/ph9e+t X-Received: by 2002:a9d:d36:: with SMTP id 51mr2421940oti.308.1586277358144; Tue, 07 Apr 2020 09:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586277358; cv=none; d=google.com; s=arc-20160816; b=hN1pSvbrqwOv/AEkUajIvL2SuDceFTQLHErO6wca7uxCUUH1lrfHHPS+f2KJwYHz2g IGhvtmw7GXu6RhczJAfw+QgN20k4jatzToW/CPIWIb8/v+dKSiIipgjCOqRhMGh3O2in UTnWA6eYQJUV9XgaMuGmjst0TOri88XggRKO2HwUXf/2i6KjMzgKLo376R/9DgrHvKQi qGW00J+bvfmRyt+xZPqaJ1vsSWKLYf+rX6/YNb3VAoBDX80+sQ/LKD05ah3Yl3wmFSvP xCcOkrnoj9MRjPz9wE1pIj+/rMnaGVcP1Fa+CPoXJALz/Zf6QAd0wIRqSHyVPAfR74NH uXPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=G7kWB/TX24QhvG8Rrfr0+QRdzK9qPke/RqlUfxE83Ng=; b=sjrhLPmtvydLLZ9dhV5QTClWFNNyFH+ya0S0JU8v4tD5bDWDnS7JjBX+s5ITXhT6HZ 0wKk4SipjmiF8kBselj2fRxaZ9fRH4g9Dve+tpNrtNrf5HgGHmb1xDSJFxXBg7BX2Po9 v52aqLkBUquhZdze/3xulu/uUpEjS41OyYEvP1uymTfca2NcRtk1lEGI+8VzD/RtToVE TwIqPW43zDf+rlcGFr5+7R51iCyvQfc34qulHmbM+Ll7bvYTo5ItXArXm/AI+FoIo1Ss aTbKiXqS/Y2O3nMrk0cgQBI9kmrl4QKnTmrKSWLF6bW03ZAph5ufaYGmnSRhYIeTdjoG sxIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 c195si918796oig.142.2020.04.07.09.35.45; Tue, 07 Apr 2020 09:35:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-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-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726884AbgDGQfU convert rfc822-to-8bit (ORCPT + 99 others); Tue, 7 Apr 2020 12:35:20 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:58633 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726873AbgDGQfU (ORCPT ); Tue, 7 Apr 2020 12:35:20 -0400 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id EB200CECD8; Tue, 7 Apr 2020 18:44:52 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH] Bluetooth: Simplify / fix return values from tk_request From: Marcel Holtmann In-Reply-To: <20200406185438.13576-1-sonnysasaka@chromium.org> Date: Tue, 7 Apr 2020 18:35:18 +0200 Cc: Bluez mailing list , Guenter Roeck Content-Transfer-Encoding: 8BIT Message-Id: References: <20200406184523.GA49680@roeck-us.net> <20200406185438.13576-1-sonnysasaka@chromium.org> To: Sonny Sasaka X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sonny, > Some static checker run by 0day reports a variableScope warning. > > net/bluetooth/smp.c:870:6: warning: > The scope of the variable 'err' can be reduced. [variableScope] > > There is no need for two separate variables holding return values. > Stick with the existing variable. While at it, don't pre-initialize > 'ret' because it is set in each code path. > > tk_request() is supposed to return a negative error code on errors, > not a bluetooth return code. The calling code converts the return > value to SMP_UNSPECIFIED if needed. > > Fixes: 92516cd97fd4 ("Bluetooth: Always request for user confirmation for Just Works") > Cc: Sonny Sasaka > Signed-off-by: Guenter Roeck > Reviewed-by: Sonny Sasaka > --- > net/bluetooth/smp.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel