Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4340351ybg; Mon, 21 Oct 2019 07:32:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAjlEj0NnUcqllq0iJeDxF/h5zBlF6z3HbPF7rogJwGwbQdfn2Ta4TmF8mVO2YoE3tymKd X-Received: by 2002:a17:906:181b:: with SMTP id v27mr22970523eje.117.1571668354529; Mon, 21 Oct 2019 07:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571668354; cv=none; d=google.com; s=arc-20160816; b=ynih5KAO+L46EHsO773Z5WpLXS73t3XzxRLOQsfQESwzl2W55o6TNHhOMJOs9zC5Pb a+UgLPnnEPh+tkad4bNFaWR8Y1qzEy2GmVCWSBvrEqudtPbF2rFC7lNEQ2dBKmoVBjLB JQmWKeuN8MZlMjaNlPUR28cQ4qmU9c3EJcAylt7O/mfhlN2TWoHskJXwSwXvVyMjQ9A7 bj39WqxZBSNkPzrKPb4nKbS4kgu7IS4Qws0Lc+9fVBV2dRBq7fqlfGdpW7ifJdyKqKV1 JN6m/ZPbCJ+r+teKisx2FEew3bS0fUAq2cMhGGVfQ98DYWXbKR/O2QLiCPnfKjkKU0wx ZWlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=/KquJOBymZRrVCk5+BNcGwv1a0KCFTHRq9xzJwTlmZ8=; b=wFPAzGCYVs7P6Ycn6lvEyXGnyZ1Ep8MBl9D0elN+Ta1qeHiNeofin1nTLSeNce27qR 2L+kXGFMws2M8hPZGugMFAXhiiNo3Gvs1gTuCpJAwPb8XGZ/rSMQ6icqHY/zhsEkFRH7 Puu5TIJ8OP+pxpwuIGFii80R48ZI1qkm3sFzpf8hHaNOmQrdEwxFbWP4C9m7r55UN61N mfZaQFBszFSZ4UvNNloAIuTq139WGERCrO5YpcGX1NIW8lwiUjlRfTTSe0PdP7eh6uGS p4NH0jro1vW06D5FeeQFYkI2GU6IZG7Mczgx1OGL0zaQ66AjlPEkVeIDQLScwsExch0T arrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k50si1113704ede.224.2019.10.21.07.32.09; Mon, 21 Oct 2019 07:32:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728881AbfJUOb4 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 21 Oct 2019 10:31:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:57680 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727140AbfJUOb4 (ORCPT ); Mon, 21 Oct 2019 10:31:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2197DC138; Mon, 21 Oct 2019 14:31:53 +0000 (UTC) Date: Mon, 21 Oct 2019 16:32:08 +0200 From: Jean Delvare To: "Erwan Velu" Cc: "Robert P. J. Day" , "Erwan Velu" , "Changbin Du" , "Boris Brezillon" , "Mauro Carvalho Chehab" , "Jens Wiklander" , "Sumit Garg" , "Andy Shevchenko" , "Michal Marek" , "Mattias Jacobsson" <2pi@mok.nu>, "Masahiro Yamada" , , Subject: Re: [PATCH 1/3] firmware/dmi_scan: Add dmi_save_release to save releases fields Message-ID: <20191021163208.5cd03d59@endymion> In-Reply-To: <20190918094323.17515-1-e.velu@criteo.com> References: <20190918094323.17515-1-e.velu@criteo.com> Organization: SUSE Linux X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Erwan, Sorry for the late answer. On Wed, 18 Sep 2019 11:43:19 +0200, Erwan Velu wrote: > In DMI type 0, there is several fields that encodes a release. is -> are encodes -> encode > The dmi_save_release() function have the logic to check if the field is valid. > If so, it reports the actual value. > > Signed-off-by: Erwan Velu > --- > drivers/firmware/dmi_scan.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) This patch introduces a warning: drivers/firmware/dmi_scan.c:185:20: warning: ‘dmi_save_release’ defined but not used [-Wunused-function] static void __init dmi_save_release(const struct dmi_header *dm, int slot, ^~~~~~~~~~~~~~~~ because you add a static function with no user. I understand that you add a use later in the series, but it's not OK to introduce a warning even if temporary. It also makes little sense to split the changes that way as there is no way to cherry-pick one of the patches without the rest. And it makes things more difficult to review too, as I can't possibly judge if this function if right without also seeing where is will be called and how. So, please merge all the changes into a single patch. > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c > index 35ed56b9c34f..202bd2c69d0f 100644 > --- a/drivers/firmware/dmi_scan.c > +++ b/drivers/firmware/dmi_scan.c > @@ -181,6 +181,32 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot, > dmi_ident[slot] = p; > } > > +static void __init dmi_save_release(const struct dmi_header *dm, int slot, > + int index) > +{ > + const u8 *d; > + char *s; > + > + // If the table doesn't have the field, let's return Please stick to C89-style comments (/* */) as used everywhere else in this file. > + if (dmi_ident[slot] || dm->length < index) > + return; > + > + d = (u8 *) dm + index; > + > + // As per the specification, > + // if the system doesn't have the field, the value is FF > + if (d[0] == 0xFF) > + return; That's not exactly what the specification says. It says: "If the system does not support the use of [the System BIOS Major Release] field, the value is 0FFh for both this field and the System BIOS Minor Release field." So unused is when both fields are 0xFF. You can't test them independently. Same goes for the Embedded Controller Firmware Release fields, even if it is worded differently, the logic is the same. > + > + s = dmi_alloc(4); > + if (!s) > + return; > + > + sprintf(s, "%u", d[0]); > + > + dmi_ident[slot] = s; > +} > + > static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, > int index) > { -- Jean Delvare SUSE L3 Support