Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2721713ybk; Mon, 18 May 2020 06:29:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxymLoULXnIfhRjz0eIYYbADEZ9HPm5ewtZ+HbdVyRN6lrnyR3uOYU3J9f93qqsxu3K8FAK X-Received: by 2002:a50:9eac:: with SMTP id a41mr13990987edf.120.1589808567242; Mon, 18 May 2020 06:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589808567; cv=none; d=google.com; s=arc-20160816; b=f+6w0MAi8eE20y/oGWhbcwtSUDkz6uCoq0rI2v0HFsoCzqXFWXZbAREn7ee0JQYcn3 bGN3sRh28AQQaa3tcNSbu8l7oYpGRtvLf493y+NBBrzUnp9VGpj13TjZso07j9tN1zBB Tu68OmF7LHp/eiLRCzJg6fxZQEHOBPKIYWqsxI8r/RSawrViTcfw/Ppfs9Lejw6oY4hN v+G33xhfei86ncM48XodOGlVxS54IsY7CWrvWKNKjLwjcIcXBBaUJAXjDPSVDrkzvNCF m9Qo+yNz/gp7TI5E5QRsH/EQEVFUhT4KPd16RKi9LM/gnOjMD6j4j6ap8Da2RxIkAEcr B3cg== 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:cc :to:from:date:dkim-signature; bh=BCGosJHcbcUtce4Hxg02+p38p5RdXX0moe9TSLTeZGQ=; b=LnsmyGkG1rL/x74cYsmNvSVD4+UONg+jfeKOF4rSk8gg8i9r7+NoQwCRkIuIaVNJwF xCQJAzx/aI3rVO5A/cJINwYqrqjnYugN3dwzIc4gbxSZzbbJMWAJl2fbljB+cpONoB2e r7w5DlvGiS0P9KDSs/cDDhyN3syzV6S2oGGhVVYyZ6XHzTEst9GFJ3lPzjM5hkB2/FD1 F5tpm26QPeUn5flu2hoQzNDYOXRjwQomB9Y4qMUvnsKHJRJLPYSShiLClQD5pc8lGAAe UUA1jGZjaCkLx2KmG98xwroIn5/QOFgyfh7pq5wv+4iB5IZ4pqWWVIZcL01CvRdQpZO4 GOaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=EH+gpxtA; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si661976edr.609.2020.05.18.06.29.02; Mon, 18 May 2020 06:29:27 -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=@oracle.com header.s=corp-2020-01-29 header.b=EH+gpxtA; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727109AbgERN1h (ORCPT + 99 others); Mon, 18 May 2020 09:27:37 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:44468 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726726AbgERN1g (ORCPT ); Mon, 18 May 2020 09:27:36 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04IDR0k6045161; Mon, 18 May 2020 13:27:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=BCGosJHcbcUtce4Hxg02+p38p5RdXX0moe9TSLTeZGQ=; b=EH+gpxtAPFyj5QeBSa5jhy+E/Rx23WKIT0T9TAicRU2pvtwcI75sQpBVVBvW3Xm5dfZW hxYu0ZQ38W0e9C42My9dRMBYGMFD34h7+d6if5yVnVtxTnE2rdifnr6W3WTJ/8vu+oGU utc4PkvEskNy2xWT/VSxfxjwA1AuidCfQBSKKS31KjzwbALLQudOdjL/KWnci0a2WdGX nM5pUE0LYFE1+1DmL1MUwsC07VkTlRyJM5BBn5NM+zBrPxfKMHMJt29rKxZHU4eO5zs8 xgqr27U0RubvYJ+1zfEwGakzooe+hP1bVfBTOG7fo1cLCuwqrkOd6BdGUGzT4DSwgFlg wA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 3127kqxrat-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 May 2020 13:27:31 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04IDOUs4108508; Mon, 18 May 2020 13:25:30 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 313ghyusxm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 May 2020 13:25:30 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 04IDPTlA004663; Mon, 18 May 2020 13:25:30 GMT Received: from kadam (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 18 May 2020 06:25:29 -0700 Date: Mon, 18 May 2020 16:25:23 +0300 From: Dan Carpenter To: Pascal Terjan Cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8192u: Merge almost duplicate code Message-ID: <20200518132523.GK2078@kadam> References: <20200517165819.136715-1-pterjan@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9624 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005180120 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9624 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 impostorscore=0 suspectscore=0 mlxlogscore=999 malwarescore=0 cotscore=-2147483648 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005180120 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 17, 2020 at 09:25:05PM +0100, Pascal Terjan wrote: > On Sun, 17 May 2020 at 17:58, Pascal Terjan wrote: > > > > This causes a change in behaviour: > > - stats also get updated when reordering, this seems like it should be > > the case but those lines were commented out. > > - sub_skb NULL check now happens early in both cases, previously it > > happened only after dereferencing it 12 times, so it may not actually > > be needed. > > > > Hi, > I actually noticed the same duplicated code (and same late NULL check) > in drivers/staging/rtl8192e/rtllib_rx.c > drivers/staging/rtl8712/rtl8712_recv.c has only one copy of the code > but with the late NULL check > drivers/staging/rtl8188eu/core/rtw_recv.c has only one copy of the > code and doesn't do any NULL check > > Now I wonder how to proceed. The code is not great so it would not > feel right to make it reusable. > Should I continue improving it on this driver only first (maybe trying > to reuse ieee80211_data_to_8023_exthdr from net/wireless/util.c for > example)? It looks like the NULL check could be removed, but it's also fine to keep it so long as it's not after a NULL dereference. Do whatever you have the energy to do... It would be nice if people who fix bugs in these Realtek drivers would check the other drivers as well but for cleanups basically everyone just works on one driver only. regards, dan carpenter