On Wed, 28 Jan, at 05:56:25PM, Ivan Khoronzhuk wrote:
> >diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
> >index e0f1cb3..61b6a38 100644
> >--- a/drivers/firmware/dmi-sysfs.c
> >+++ b/drivers/firmware/dmi-sysfs.c
> >@@ -29,6 +29,8 @@
> > #define MAX_ENTRY_TYPE 255 /* Most of these aren't used, but we consider
> > the top entry type is only 8 bits */
> >+static const u8 *smbios_raw_header;
There appears to be a mixture of u8 and unsigned char going on here, cf.
'smbios_header'.
While I'm pretty sure all architectures typedef them to be equivalent,
semantically, as a reviewer this makes me think there are type issues.
Is there any way to use one data type for the SMBIOS header?
> >@@ -669,6 +699,18 @@ static int __init dmi_sysfs_init(void)
> > goto err;
> > }
> >+ smbios_raw_header = dmi_get_smbios_entry_area(&size);
> >+ if (!smbios_raw_header) {
> >+ pr_debug("dmi-sysfs: SMBIOS raw data is not available.\n");
> >+ error = -ENODATA;
> >+ goto err;
Perhaps this should be -EINVAL? -ENODATA implies that if you try again
in the future data might be available, i.e. it's a temporary failure.
That's not the case here since the header is invalid.
--
Matt Fleming, Intel Open Source Technology Center
On 02/03/2015 12:49 PM, Matt Fleming wrote:
> On Wed, 28 Jan, at 05:56:25PM, Ivan Khoronzhuk wrote:
>>> diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
>>> index e0f1cb3..61b6a38 100644
>>> --- a/drivers/firmware/dmi-sysfs.c
>>> +++ b/drivers/firmware/dmi-sysfs.c
>>> @@ -29,6 +29,8 @@
>>> #define MAX_ENTRY_TYPE 255 /* Most of these aren't used, but we consider
>>> the top entry type is only 8 bits */
>>> +static const u8 *smbios_raw_header;
> There appears to be a mixture of u8 and unsigned char going on here, cf.
> 'smbios_header'.
>
> While I'm pretty sure all architectures typedef them to be equivalent,
> semantically, as a reviewer this makes me think there are type issues.
>
> Is there any way to use one data type for the SMBIOS header?
Let it be u8 in both cases.
>>> @@ -669,6 +699,18 @@ static int __init dmi_sysfs_init(void)
>>> goto err;
>>> }
>>> + smbios_raw_header = dmi_get_smbios_entry_area(&size);
>>> + if (!smbios_raw_header) {
>>> + pr_debug("dmi-sysfs: SMBIOS raw data is not available.\n");
>>> + error = -ENODATA;
>>> + goto err;
> Perhaps this should be -EINVAL? -ENODATA implies that if you try again
> in the future data might be available, i.e. it's a temporary failure.
> That's not the case here since the header is invalid.
>
Yes, -EINVAL is better.
I'll send new patch soon.
Thanks!