Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp348332pxb; Wed, 14 Apr 2021 17:27:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7lwjDfzgGsUf5O+OQKl75/rHX5lyiSKp44Q9LP087nM93Khp37JLQHE7JsiwwWbXbNB0G X-Received: by 2002:a17:906:4cd9:: with SMTP id q25mr677545ejt.187.1618446428964; Wed, 14 Apr 2021 17:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618446428; cv=none; d=google.com; s=arc-20160816; b=GdEhvz6FlmFeR08buWQ4/NlS8HD0hpne3sQodEvl/ZauI+TdlnQzYDK9xiiasOAquQ 3nq27x6ADyw824oAHC911758Fz2QzbVaQVqsKabT/R5vA6P7F7/vU4+hwoFL1eToetqm pnaXceO8GadnPEGSxLBgwYx49Jak+qQgKvYxF8o/FGtnFQbKK5JwttLanrNSpvUyWnx1 Sb8G3Kd7sSh0kGnshf6L9e4PPTbLfpkCxCskaIu+MqmOwPWUDChY7e9+f+k9yE+aX8J8 CE70ypKLlbGNr6u8HBIOAozKcASr9uW86pIlEuIdQiuh5HfR7h8MCnRhNT+OdOqqi8hZ AZHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ENoaVUYqcoflF8xWOIWULroGO6u264X9NRgbkfRf5wI=; b=lY4+OQbEsq9leXm4Kx9urNgQgOC5wdYpilxk0yNRMfllL8FXGILHW9U7Qx3LPt1DhG EAnajhRtqviFq0qsnL2pim0/4gpkM1z9Q++E3R7+mjT3cCm+ASekBGh6Ik5mh6xdhQjB bA3JRur8QZ7EcMBLN10XllFOxYG7huLnwhHli+dwoBBuHMPA0FFXrEsI19Q+sAZb6xEy Q6lz9YD9F/D+uZzgOIIQn9fFUHKczrmnjJuGhWuwn86XfpkInlCNRaAeUPM2uuMe65UZ 8s6LKdTP2sJifL+3JRinqJDMAyTfRhYHqQk+vDm3WWIGYjES/0eX8ahTtRa+g7ktvkZ4 EOWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F8sRkgXy; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si972498edr.347.2021.04.14.17.26.46; Wed, 14 Apr 2021 17:27:08 -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=@gmail.com header.s=20161025 header.b=F8sRkgXy; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233174AbhDNN13 (ORCPT + 99 others); Wed, 14 Apr 2021 09:27:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232690AbhDNN12 (ORCPT ); Wed, 14 Apr 2021 09:27:28 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A461AC061574 for ; Wed, 14 Apr 2021 06:27:06 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id u17so31431195ejk.2 for ; Wed, 14 Apr 2021 06:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ENoaVUYqcoflF8xWOIWULroGO6u264X9NRgbkfRf5wI=; b=F8sRkgXyBy638AVKUfcQGHQvtUeVt4DOeps/NhbhqPWwPXiCtEmYAZVpuwrm/5l/JZ U5qTGgXQpFc2/gczGUGroXph8hQcYwR9WZajmdQe2EWyifb/ArmEP0Aw53gTdAoX3qMs tNcxkOQq63t25zMocVzm458Tj63pmUvsoIdX0iHvvkl/S96VpW+CuyyC10tl/n09Ci2a F0Bebag7Q7MXDIV1SkTj8PwvT2eWv4nx4l6ISsG6AE8ZK/+t/2mkH7m87OVKCjdQ7iyr HOysRtCyzdBmNa+RJHlt5Mp88QCfAKU1u03LPq1r44+wCZzoQfiXarz6mGn7AGaCafL8 NPvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ENoaVUYqcoflF8xWOIWULroGO6u264X9NRgbkfRf5wI=; b=ak/9vwYDBNYgOT+lkvoC41Vw0SaHxa2RlL0vkkiK5zmfzitvLNTS8uBvl0W8qKRfaY L4XcEbUhSghWpN9llHu0gVuf4ydakt+CgIAjN/GWIV7BKb/VVo377KOHxOdYHTgRGdnz AGt42gFwsDKC7FZWzrqbz3fIKog3+iQxFx6X/KHWTEOjnRlVSuEN+kCwlmI/yeSM2p+b wrUb3imo5X87tpJtGHA1o1rBD4BPSaXzY6Q8V/+hCMSjJ1AkV1zTrVtRfUZ2ClNEMSJW E9svTKKR1Wob2MyJcV9LUSFI+VGdJ+dB1pOFNehygl1Fuy827XXlGn6nnpBkTQQ4eGd1 xPCg== X-Gm-Message-State: AOAM530FTeX/fA3i9kxqFt675/AqnJi48YClOMqSGEjLaAKmMGqEVVzx ZADSRX5fz4JmfXftSYINWAs= X-Received: by 2002:a17:906:37c9:: with SMTP id o9mr19026672ejc.285.1618406825395; Wed, 14 Apr 2021 06:27:05 -0700 (PDT) Received: from linux.local (host-95-237-55-30.retail.telecomitalia.it. [95.237.55.30]) by smtp.gmail.com with ESMTPSA id u4sm7999489ejf.11.2021.04.14.06.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Apr 2021 06:27:04 -0700 (PDT) From: "Fabio M. De Francesco" To: Greg Kroah-Hartman Cc: outreachy-kernel@googlegroups.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Matthew Wilcox , Julia Lawall , Dan Carpenter Subject: Re: [Outreachy kernel] [PATCH] staging: rtl8723bs: Remove useless led_blink_hdl() Date: Wed, 14 Apr 2021 15:27:03 +0200 Message-ID: <2135425.qiX1NcrmH6@linux.local> In-Reply-To: References: <20210414115243.32716-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, April 14, 2021 2:18:13 PM CEST Greg Kroah-Hartman wrote: > On Wed, Apr 14, 2021 at 01:52:43PM +0200, Fabio M. De Francesco wrote: > > Removed the led_blink_hdl() function (declaration and definition). > > Declared dummy_function() in include/rtw_mlme_ext.h and defined it in > > core/rtw_cmd.c. Changed the second parameter of GEN_MLME_EXT_HANDLER > > macro to make use of dummy_function(). > > No no no. > > If you want to remove is function declaration and use, then do it > properly. > > The code is crazy, I agree, but it should not be difficult to just > remove this correctly instead of papering over this mess. > > Also note that no one actually calls this function if you look at the > logic here. > > It might take some good knowledge of C to unwind this crud, > but once done, you should be able to "prove" it's not called > Proving that no one actually calls it it's beyond my current knowledge of programming with C. Matthew W., who is for sure more experienced than I am , wrote that that function pointer in the array is used somewhere else. Copied and pasted here from his message: "Here's where the driver calls that function: $ git grep wlancmds drivers/staging/rtl8723bs/ drivers/staging/rtl8723bs/core/rtw_cmd.c:static struct cmd_hdl wlancmds[] = { drivers/staging/rtl8723bs/core/rtw_cmd.c: if (pcmd->cmdcode < ARRAY_SIZE(wlancmds)) { drivers/staging/rtl8723bs/core/rtw_cmd.c: cmd_hdl = wlancmds[pcmd->cmdcode].h2cfuns; > > and how to > remove it correctly. > I think that doing it correctly depends on the "prove" which you requested. Doesn't it? > > And no, I'm not going to say how to do it, that's an exercise best left > for the reader. > It sounds perfectly reasonable and I agree in full. > > But I will hint that this was done in the past, in > 2014, in another driver in the tree with a codebase much like this one, > so it shouldn't be hard to find an example of it. Only took me a few > minutes... > I'm sure it took you only a few minutes. If this can be accomplished by using grep on git log output I need some time to read this command manual again. I suppose that the search should be made by combining "remove", "function", "drivers/staging", and "2014". At the moment I don't know how to do that. Notwithstanding I have said all that you read above, you can be sure that I won't give up so easily even if it will take days :) > > good luck! > Thanks, Fabio > > greg k-h