Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2587396pxb; Tue, 24 Aug 2021 02:46:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhJ1aHQ9vFEBv2z0GPoKke/WYiXYvJmOPSQDk+iWGyb6kgtj55R951I85iST3LqApYxLdd X-Received: by 2002:a5e:d80e:: with SMTP id l14mr30805880iok.79.1629798418075; Tue, 24 Aug 2021 02:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629798418; cv=none; d=google.com; s=arc-20160816; b=qSJVtpF60oatwNj7Yu3B6uaeqH8nGtdClvdc3XJJE1RKChCpWtzTDWARSAG0VFqX4f 7Qg54LHtjLKqZ29Rx82y5tMUlvNj5Ot89ZNK191URp/OKgFXxOUxQhhrU+1mhenGfRTE 0UHLPfw/01l8cF4qxMmmJ0+zUOuoL+ZLN5aClyyME+Hhk/Y8o+C6doZ82wKMOlDSplya Npj+2QK8P+qy3cFGzojyJEA2EbzRQAZI9la3TSyXxvrY78s1jtJUu7dglIa8ZciqbMhK nDkz2uWnzLAvZoRGBCfpRlUeNJansEjY9ixWeLz6l8S+n1LN8d9Apkzk3CPiQ8S0fBbt ZTUw== 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=GrvCsUcjOz7dr6yABmwTuSZ2PSKxdeNbsF0RweGK1nA=; b=M5S70A+c87WxKfc3NFesf3DWkt3XDdKjr252fg7ybJsO3w/eVLq4R2aew2goBtOYNn 8lMVClO88Z3LIhafES5AYklnqec2G6+vbUvnPQy0aT+vMKRjSCAcj636iJ7/hlCQ/Kzm O2CAkWw0O+21Ee9i1G6SDk0/GT78xpheamj7M0B4wFAr/f3mm38Q2hHHqPjDDDnTw9l2 aYxnwvCk1877PsrZJeV6vcuqIAzEbBLF69u5m8e9PovpVlwNx6tlOuWhYCtl1ppYTh7i i/Agz9SP1iQBwsK5E4BO6r4KOD1f8noowmQHUtEKdIekOle8EDSt3u3Twl9vS3wx1vwZ 5fFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SfrMyhqS; 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 m2si18781172ili.39.2021.08.24.02.46.46; Tue, 24 Aug 2021 02:46:58 -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=SfrMyhqS; 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 S235686AbhHXJqv (ORCPT + 99 others); Tue, 24 Aug 2021 05:46:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235566AbhHXJqu (ORCPT ); Tue, 24 Aug 2021 05:46:50 -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 954ABC061757 for ; Tue, 24 Aug 2021 02:46:06 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id mf2so24514160ejb.9 for ; Tue, 24 Aug 2021 02:46: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=GrvCsUcjOz7dr6yABmwTuSZ2PSKxdeNbsF0RweGK1nA=; b=SfrMyhqSjfQbmPAWlBf7A8NR1eYktlZG2/doJX1lPcFWXKrUqHC20co4Rqt2090JZf l7dPmSiswukViMZ3kJt24xlHREf2prZjK4R+NndnlrJ4aEaW9C8ontAlSyakwd/k2X+o 2rnqqGQ3Yso7ZCgMdU+OC5WfLNEepewf+SA28tx/1M24yYgZJkGri8LXnF/1rAGg2YlI BouxtR/pHMsFVaTyRrpKB7Bp4DZ6WnbrwHfuiD6PbSzuoK2ESbwWFGk8IIpm5iH9vU4B VgvCy4QbR0PTRYSmFXU/UPURFFIBZPQARujNioRHj6W9AB/1H2v+KiCOAtp7T2AwwOmk +jsQ== 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=GrvCsUcjOz7dr6yABmwTuSZ2PSKxdeNbsF0RweGK1nA=; b=VVMyxpwqHkPcZJuNuH4gje29S33M39gRK4UxbNWBn2pFh1ugfZnAMvrIrNozvZXaZh qgKNAzenvb1jv+SMh2SiV+dLUkV9Ds2BCQE5capJjm5lOkmqDQnnDYLtKiJZkGQlL/jF FU4bL4yedQsXFHHRTpTrmLfNu5/NjTVdq0bolR9937337wpIdOkr2ARAQeNyrabaURcd wRn4sYaUFrqUO02PejQIO3VjLEZmGPm0XYnPSp6Lyolq4ZYcJ3Aqvqsma5MAi9kOWDsg 126A0zpg6/Q31f9hnNMIYTFSegaelKTU2M3peMkzWGGtIYr8pNW97VLrb2mEUFhJnkhR dkfA== X-Gm-Message-State: AOAM533/D9HeN8/18vBJboq8IiHEjYYr8sO5yKZjerhQeDmMsl+ce93b aKnv1m5ak/Lvm0lHFaGygSo= X-Received: by 2002:a17:906:38c8:: with SMTP id r8mr40555690ejd.172.1629798365221; Tue, 24 Aug 2021 02:46:05 -0700 (PDT) Received: from localhost.localdomain (host-79-22-100-164.retail.telecomitalia.it. [79.22.100.164]) by smtp.gmail.com with ESMTPSA id qh2sm8839076ejb.75.2021.08.24.02.46.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 02:46:04 -0700 (PDT) From: "Fabio M. De Francesco" To: Phillip Potter , Pavel Skripkin Cc: Larry Finger , Greg KH , Michael Straube , "open list:STAGING SUBSYSTEM" , Linux Kernel Mailing List Subject: Re: [PATCH RFC v2 5/6] staging: r8188eu: add error handling of rtw_read32 Date: Tue, 24 Aug 2021 11:46:03 +0200 Message-ID: <1970955.u25yFflyLQ@localhost.localdomain> In-Reply-To: <96e3703e-a5e2-3c6d-ea3c-b5d3892849b2@gmail.com> References: <77da7c63-a5b1-a09d-39ec-32c5485b8eac@gmail.com> <96e3703e-a5e2-3c6d-ea3c-b5d3892849b2@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, August 24, 2021 10:53:35 AM CEST Pavel Skripkin wrote: > On 8/24/21 11:47 AM, Pavel Skripkin wrote: > > On 8/24/21 11:38 AM, Fabio M. De Francesco wrote: > > > > Hi, Fabio! > > > > previous usb_read16() realization, which is 100% right: > > > > > > static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr) > > { > > u8 requesttype; > > u16 wvalue; > > u16 len; > > __le32 data; Ah, it was in plain sight! How didn't I notice it? :( > > > > requesttype = 0x01;/* read_in */ > > wvalue = (u16)(addr & 0x0000ffff); > > len = 2; > > usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype); > > > > return (u16)(le32_to_cpu(data) & 0xffff); > > } > > > > > > Bases on this code, I think, it's oblivious, that data comes in > > little-endian. That's why I leaved temp variable for casting le32 to > > cpu's endianess. Yes you did well (if we trust the old code :)), anyway I guess it was correct because I've just seen that data is __le32 also in other Realtek drivers. > > > > I could just read into u{16,32} * and then make smth like > > > > *data = le32_to_cpu(*data) > > > > but static analysis tools will complain about wrong data type passed to > > le32_to_cpu() Obviously the (not broken) tools should catch that and complain. > > + Phillip tested fixed v2 version and it worked well for him. I guess, > > Phillip was able to spot weird driver behavior, if this cast is wrong. > > > ^^^^^& > > I am wrong with this statement, I guess. Most likely, Phillip is testing > on smth like x64 and this arch is le, so... > > With regards, > Pavel Skripkin > Thanks, Fabio