Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2488589pxa; Fri, 7 Aug 2020 12:21:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcq6mvShmcSNMnYB7zPcufYeiAkRodcekHh9jdd4iU+k408UuPN6Q1lHBSdbDw9syxYZZw X-Received: by 2002:a05:6402:1d92:: with SMTP id dk18mr10019903edb.206.1596828100349; Fri, 07 Aug 2020 12:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596828100; cv=none; d=google.com; s=arc-20160816; b=NIKTG1hd4bXtLYIpa991EmUpi5TmmSdIxs0MzmgCOxSLI1ySsfWU3DPTnVdruqSQwC XXbfERkn3BTBbdDoooRNXVcAa07IsZ3uW6jUf84gXNp0VUv4cG6DEokjDaViauXHqyOw hQoMEw+8TTaWThw/iFPzpDB4j1l8VarVyfPkvyDroih3+RCs4C6l/fjmlIg1G/wQa0eH GAso4U6Vs46ED5k3WkhU+UPAjz9yKiiKSzbIc1Onhl3QJQYfBBlUumVIIWDP/4D5XuVI f6Unco95w3dcgInaDUsRbUtiIQ8P6RV3NNMshsuFmgRotvb0fhCt52EJmFqv2LeGOPib BNIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date; bh=HFXN9CL7CHqYrE+zmepMLbswGPUaxlyclu2SFNjaotY=; b=RXP5ikkA9W1J2pNWg1YLiHRD0YwHym2Urq/GeQSuM1IBA7sd7yc7ilc9GAJ6Q2DIwM 17w9pUQQ2GjrDr9wTE0T0qSsGcfe7V/4I/Q0MtEip/WeesBcrIbp61mXE6XeqmAcUlUy g+kfILcDdsM+/UC36oARRtiSfvX/93hHlty3zZUDFuxsPXIn6E9GB5ioAdwKHVd/taQw 8TB9WhSu2hfHZFG3e5AanAoclIVi5HCu/YknBtEaL0ojuk+Li0YrphewpbGEraaTUAC4 kJJY8T5kg0+dz0xDTiAQ5YCPAFIHI8iIl19bSpfKqHAZLMgzoEsotnUIxe9i4dqa+KpV RkNg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ks22si3738961ejb.635.2020.08.07.12.21.16; Fri, 07 Aug 2020 12:21:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726045AbgHGTTp (ORCPT + 99 others); Fri, 7 Aug 2020 15:19:45 -0400 Received: from 9.mo178.mail-out.ovh.net ([46.105.75.45]:60523 "EHLO 9.mo178.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbgHGTTo (ORCPT ); Fri, 7 Aug 2020 15:19:44 -0400 X-Greylist: delayed 97337 seconds by postgrey-1.27 at vger.kernel.org; Fri, 07 Aug 2020 15:19:43 EDT Received: from player715.ha.ovh.net (unknown [10.108.42.82]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id 791D1AC1D7 for ; Fri, 7 Aug 2020 21:07:20 +0200 (CEST) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player715.ha.ovh.net (Postfix) with ESMTPSA id 76BA814E9C8DB; Fri, 7 Aug 2020 19:07:13 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-100R0038ca687ab-4f78-4da8-bbe2-7590c3ca912e, B1FDDFD4E508142116FDFB9194C63E8FBE397CFD) smtp.auth=steve@sk2.org Date: Fri, 7 Aug 2020 21:07:07 +0200 From: Stephen Kitt To: Guenter Roeck Cc: Jean Delvare , linux-hwmon@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Wolfram Sang Subject: Re: [PATCH v3] hwmon/pmbus: use simple i2c probe function Message-ID: <20200807210707.7dd1d9b9@heffalump.sk2.org> In-Reply-To: <20200807173231.GA47449@roeck-us.net> References: <20200807173231.GA47449@roeck-us.net> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/ZFB90kCEm=UKbNJ8Un9J6qQ"; protocol="application/pgp-signature" X-Ovh-Tracer-Id: 11990834011428048142 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedrkedvgdduvdelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffukfgjfhfogggtsehgtderreertdejnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeevledvueefvdeivefftdeugeekveethefftdffteelheejkeejjeduffeiudetkeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeduhedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpehsthgvvhgvsehskhdvrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhg Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/ZFB90kCEm=UKbNJ8Un9J6qQ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 7 Aug 2020 10:32:31 -0700, Guenter Roeck wrote: > On Fri, Aug 07, 2020 at 06:28:01PM +0200, Stephen Kitt wrote: > > =20 > > -static int ltc2978_probe(struct i2c_client *client, > > - const struct i2c_device_id *id) > > +static int ltc2978_probe(struct i2c_client *client) > > { > > int i, chip_id; > > struct ltc2978_data *data; > > @@ -670,10 +669,10 @@ static int ltc2978_probe(struct i2c_client *clien= t, > > return chip_id; > > =20 > > data->id =3D chip_id; > > - if (data->id !=3D id->driver_data) > > + if (strcmp(client->name, ltc2978_id[data->id].name) !=3D 0) =20 >=20 > I was about to apply this patch, but this is problematic: It assumes that > __stringify(id) =3D=3D ltc2978_id[id].name and that ltc2978_id[id].driver= _data > =3D=3D id. While that is curently the case (as far as I can see), it is s= till > unsafe. I think it would be much safer to use i2c_match_id() here. I=E2=80=99m not following the __stringify assumption, but I do get your poi= nt about the driver_data being a valid index into the array; that was already baked into the code, as dev_warn(&client->dev, "Device mismatch: Configured %s, detected %s\n", client->name, ltc2978_id[data->id].name); but I=E2=80=99ll fix both. Similar assumptions are present in other drivers here IIRC, I=E2=80=99ll fi= x those too. Regards, Stephen --Sig_/ZFB90kCEm=UKbNJ8Un9J6qQ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEnPVX/hPLkMoq7x0ggNMC9Yhtg5wFAl8tplsACgkQgNMC9Yht g5zbIA//S0DouNct8J2rS/6Fe3PdwZrMiAJ7FNNKqTzQDbt7Il2R8rcdXM9HVPbH sxloEI7MB+HbiQFRFIXlHL5xR5oBb3cUkZzstyc+SvXo+AVjYV9B+v9vjWHKAP9Z GgWV65P20HCtbLAat9hDMFzTGaDcoEbBzrPOdCodPrT/mA+E287tLaubw97+uWWz aGaoub1huJvS4HO+DTNVX6uUBslilnZXhn/LKLDvgDOqtUMnsBIdrSI7b6bgO78r MVou0LxSaPOxl2+nr2xJDnQILUxzsWtOROIYWgGpU/K/xpufgHWmqk1ia0iV8lUE BVkF/C6uduW1Zip8QcG17c/eorIfFkkzstntnQGuicbSOWHlzvuomtUn64/zC54h u5gncBtmrF52+sp8YbLvhyT5EgyDDS6DY0QnPg31K+V2sfGQDACCNGeLuTGaXO5N qYhSzCbhYsnO4sAqonhFw4Jbyt6hbf0tLEz5ikEejRCj+7vL0BPiZYYkzEvV3qxy YoVDJyunjR9BIEn7DuxBRcr837TXL6gMU2ZyXB4Vu1NM/gv2VOwLoW+Ey8JcCNX9 t4lszJmVaRseXHaNtxff0Yzp8JaLUK3v1t3NXSCsno5hGE4qTg84o9MLrW/yRGZu QcTEwA+udmbU8nX/Wdlm6Fih+31H95mO0ElljLfjgsUrKUP2fX8= =XC8G -----END PGP SIGNATURE----- --Sig_/ZFB90kCEm=UKbNJ8Un9J6qQ--