lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 12 Feb 2024 13:59:42 +0100
From: Konrad Dybcio <konrad.dybcio@...aro.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
 Bjorn Andersson <andersson@...nel.org>,
 Marijn Suijten <marijn.suijten@...ainline.org>, linux-usb@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: typec: fsa4480: Check if the chip is really there

On 12.02.2024 13:48, Greg Kroah-Hartman wrote:
> On Mon, Feb 12, 2024 at 01:01:30PM +0100, Konrad Dybcio wrote:
>> Currently, the driver will happily register the switch/mux devices, and
>> so long as the i2c master doesn't complain, the user would never know
>> there's something wrong.
>>
>> Add a device id check (based on [1]) and return -ENODEV if the read
>> fails or returns nonsense.
>>
>> Checking the value on a Qualcomm SM6115P-based Lenovo Tab P11 tablet,
>> the ID mentioned in the datasheet does indeed show up:
>>  fsa4480 1-0042: Found FSA4480 v1.1 (Vendor ID = 0)
>>
>> [1] https://www.onsemi.com/pdf/datasheet/fsa4480-d.pdf
>>
>> Fixes: 1dc246320c6b ("usb: typec: mux: Add On Semi fsa4480 driver")
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@...aro.org>
>> ---
>>  drivers/usb/typec/mux/fsa4480.c | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/usb/typec/mux/fsa4480.c b/drivers/usb/typec/mux/fsa4480.c
>> index cb7cdf90cb0a..d622f4f3bd54 100644
>> --- a/drivers/usb/typec/mux/fsa4480.c
>> +++ b/drivers/usb/typec/mux/fsa4480.c
>> @@ -13,6 +13,10 @@
>>  #include <linux/usb/typec_dp.h>
>>  #include <linux/usb/typec_mux.h>
>>  
>> +#define FSA4480_DEVICE_ID	0x00
>> + #define DEVICE_ID_VENDOR_ID	GENMASK(7, 6)
>> + #define DEVICE_ID_VERSION_ID	GENMASK(5, 3)
>> + #define DEVICE_ID_REV_ID	GENMASK(2, 0)
> 
> Why the indent?

In many places across the kernel, bitfields or possible values of a
register are defined with an indentation to emphasize the relation between
the defines

> 
> And those are _VERY_ generic #defines, please give a better name for
> these so you don't conflict with other stuff in the kernel accidentally.

If you don't mind them becoming very long, I can prepend them with FSA4480_,
and I suppose shrink 'VENDOR' to "VEN" and "VERSION" to "VER" to compensate

Konrad

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ