Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3536806pxb; Mon, 4 Apr 2022 20:22:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/pGfvFh7sopYCQFYuR/kgubvbc/TND6Anmn4df8RhVHuIIS7gMJn+s0QzO8gIkGiYfUu1 X-Received: by 2002:a17:903:283:b0:153:ad23:8d37 with SMTP id j3-20020a170903028300b00153ad238d37mr1293269plr.168.1649128922564; Mon, 04 Apr 2022 20:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649128922; cv=none; d=google.com; s=arc-20160816; b=vjCICe/ShOdPKnz2POE5mHSwcBzXwXN27e+UHg9YTVbTXkgNdx43U+6URhYo30hCn3 hYATb8FKnPXNRToGO7RJKqsbUA+1kVWMUzVD/3JqiUaAvNiuvoDPqKhG2cfQ4X9XDCoe nnV7d/dSadt3WJJ3Y1hJqaqyLrTNjwhnze4Vyx40FwTkCJv1DZHjAAIR6AkfWV+WMzBW b/1wKZrSZ1ho/FAtXdbDbsqGweWjAboCMDlhZN5746vj982H8Af0TzBksRrSvA26kJN7 +/K4qNK0Yq0HJtcP0osFP93yj8IOpSQi+H/P9bXjlKAqI5PY7TXi19q209tIGw1cBwhk 1WPg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fg7D1iGUfw9j684AaN9ZwUUtm9p5W+5qSKHanyjniig=; b=oLnmo4Gn+ISZ1tSZ1gc1KebUqL4pvp5XV1i/91FqBiny4YZ5eU87hwkZe09sxUCqIr VR58vKygQSif3wQNuel7WExq6hPA+HTRwbJzl61oU00PIx8Juom4TKAbsHUGkdnxxYUd Tgp9tiWINN0pwAmcmFyv3FGfXPvy5rnorLVLai5+TT0RcAPt7qP/AC2kgqcEgKjHaoPu F1L5NH05Pfm55atUI45bWw62d/eUQ8xBoClJO/sH+OUzYY8Ubc/M8RFLHyM4TyhNABjn kgSE15tJ//PTAZ/zJLMwaWvCSIr3XdedNxBsOVo+vFZl1f+chQN9o/tZpOvtuiBRYrqI xaCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XhKe6RBz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s27-20020a63af5b000000b003816043f04csi12369327pgo.577.2022.04.04.20.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 20:22:02 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XhKe6RBz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A97AC345465; Mon, 4 Apr 2022 18:21:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243591AbiDBOJC (ORCPT + 99 others); Sat, 2 Apr 2022 10:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230301AbiDBOI7 (ORCPT ); Sat, 2 Apr 2022 10:08:59 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FDEDFFB56 for ; Sat, 2 Apr 2022 07:07:04 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id v64-20020a1cac43000000b0038cfd1b3a6dso5073257wme.5 for ; Sat, 02 Apr 2022 07:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fg7D1iGUfw9j684AaN9ZwUUtm9p5W+5qSKHanyjniig=; b=XhKe6RBzOIYGM7e1jgWJtS6NaOo4+4DLXXecjeNVeEgHXKdrxJ54a8D6RAAHjJ5QOY BlkaPbXoCClrtXJ5Rl+dzMbMRuL69iFqyY0BlGEa6j7/TXmR7/nEewXOEipQuLbycwIk EER4AZGnsSfOtNsL0LkfXOnzds3+z1PJQxYRzwP81AX1QWdDebCsV0KWRSnw+6vtvogF RGJiuz0XHVxeTkSCQToYFFxfOD4hKaSZBJZQnk7D3gzEXzm/YPXTNKl87tQ7RD8FIWFg BkOTUR5Vqcs+P3DxcqD53+CDLJ/i8yM0CGVjDbEQsxQBmYHYyBnwouSSEkHLUR5Y/cz0 LmFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fg7D1iGUfw9j684AaN9ZwUUtm9p5W+5qSKHanyjniig=; b=nLJDSyE9314PlCewNDamvEEQr9cQ3BP5+1fCKHncF4FGmCJYEZnlJY2Ub5017CEwms Z10IXeXCDMzX7GckPOUjto+Vgy1y9965bpWr67AU05XwPG4f/xdhXZm9UpZPSfwLogyW /iBqMs7sJxxrMKfNBurCH+zCO2y4TJmeXvr/b7KdxiY/Kof9a94BN8i8K/G8AW5ujthD dlnjNSpSZFEo2nBrB7PPzpFJetTwduZgQwnzizW5AWYhiEDSzmQFXtVylBRf2HcVt1XI LMFe6sp7JPi1yFO2wTamMZRcJvpt/LsrXCrPMuGbNoqyBOJBX/nKWlJzc+CTndMfSXrH jzhA== X-Gm-Message-State: AOAM531inbEhoKkg2lZaK0Wk+VwBcPMof26O5Y8UVJ0374LJKJbpT6Xl rgW2HZYxMOtN4ZvOsTVjLHw= X-Received: by 2002:a7b:c5d0:0:b0:355:482a:6f44 with SMTP id n16-20020a7bc5d0000000b00355482a6f44mr12523721wmk.58.1648908423127; Sat, 02 Apr 2022 07:07:03 -0700 (PDT) Received: from localhost.localdomain (host-95-249-145-232.retail.telecomitalia.it. [95.249.145.232]) by smtp.gmail.com with ESMTPSA id z13-20020a5d440d000000b00203f2b010b1sm4638195wrq.44.2022.04.02.07.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Apr 2022 07:07:01 -0700 (PDT) From: "Fabio M. De Francesco" To: Larry Finger , Phillip Potter , Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy@lists.linux.dev Cc: "Fabio M. De Francesco" , Pavel Skripkin , Martin Kaiser Subject: [PATCH] staging: r8188eu: Remove redundant code from rtw_free_netdev() Date: Sat, 2 Apr 2022 16:06:57 +0200 Message-Id: <20220402140657.10549-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In rtw_free_netdev() there are two redundant tests. The first checks for a valid pointer to a "struct net_device". This pointer is the argument of rtw_free_netdev(). The two callers of this function already test this parameter immediatelly before the calls. The second checks for a valid pointer to a "struct rtw_netdev_priv_indicator". This pointer is always valid and, even if it were not, vfree() is a no-op on NULL pointers. Therefore the above-mentioned two "if" statements are unnecessary and redundant. For this reason, remove these two tests. After removing these tests there is no more need of the "RETURN" label. Therefore, remove also the "RETURN" label. Cc: Pavel Skripkin Cc: Martin Kaiser Signed-off-by: Fabio M. De Francesco --- drivers/staging/r8188eu/os_dep/osdep_service.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/osdep_service.c b/drivers/staging/r8188eu/os_dep/osdep_service.c index 7a6fcc96081a..fc10eefe04a9 100644 --- a/drivers/staging/r8188eu/os_dep/osdep_service.c +++ b/drivers/staging/r8188eu/os_dep/osdep_service.c @@ -116,19 +116,10 @@ void rtw_free_netdev(struct net_device *netdev) { struct rtw_netdev_priv_indicator *pnpi; - if (!netdev) - goto RETURN; - pnpi = netdev_priv(netdev); - if (!pnpi->priv) - goto RETURN; - vfree(pnpi->priv); free_netdev(netdev); - -RETURN: - return; } int rtw_change_ifname(struct adapter *padapter, const char *ifname) -- 2.34.1