Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2429301pxb; Sat, 30 Jan 2021 02:18:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyS3ioAQHsDV4r8vSVoxu2YfwYk8Mh+tTEZwFB93CRBqogVK5y9OuMtA+tmakMc46BmV6Km X-Received: by 2002:a50:d987:: with SMTP id w7mr9748236edj.356.1612001901149; Sat, 30 Jan 2021 02:18:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612001901; cv=none; d=google.com; s=arc-20160816; b=ZnYTu28z4JJDq+aDXqLvvIwVyIb+jLK6gxx3mx4++si+CbZzv9+Es/TFM9233T84KP dm5uPUIY/NspepMO5lgeF3fAiQMKN68DJjBkVM34uoINNrYEsCEk2OLYfCDLKgIFPOL0 X1A5KWPlHOQXgXcQSqMu19RP6XPk0Z97HaD/fpFQ4ClRNfGLV3NaHKSSHAoAMzW+HJSL XRDvbLxZ7Wxzil9zPkC7PncoFISA0wyDRpXQ2SUn8fXAVtj5i4P7vkwLQltslgkuSueS MEIX7gBu0+LzDxdZg14aPMD3ApB0kPY/2CphfnDskZh09odvkIzOmyJD1KHfI5gNy6w1 7Ycw== 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 :message-id:date:subject:cc:to:from; bh=zvUr5XKp3f5scELHU3CvVmUS4ljQor/WYXSDsolCYdQ=; b=wE08UnMFI4rLdWOzfzk0+kA7deWMFy+42iueRZ+r+032unpbD5jX64X+6Naw/Tegx2 DWLHRkWJUiTUiYaWHLp0DC0kNizJGrHGnj2zFesfRfGzVpCah9lFXHWYOJqtBAhp5+lL 4puASVqjMEvRvi6JtNqh2zrHjNTuKdKwmc2NvrDMl6bC7nQdTyO7WXaV0rPuMh+A70yP HXAbRqC28V6u6EBvARzPuPe4gYvNJyNmKkgXGaKTdFE+hZsF9z3bp8xv7T4xtwEriFbA CR2CocgyL9iUZlvfKIA35uC7lQyeZDP3DVmjKjy2R1qXqS0evp38Rx/ink0hXHeoXJZa d+vQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=msu.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sd11si6255505ejb.584.2021.01.30.02.17.56; Sat, 30 Jan 2021 02:18:21 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=msu.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232190AbhA3KQM (ORCPT + 99 others); Sat, 30 Jan 2021 05:16:12 -0500 Received: from lnfm1.sai.msu.ru ([93.180.26.255]:57582 "EHLO lnfm1.sai.msu.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232036AbhA3KPV (ORCPT ); Sat, 30 Jan 2021 05:15:21 -0500 Received: from dragon.sai.msu.ru (dragon.sai.msu.ru [93.180.26.172]) by lnfm1.sai.msu.ru (8.14.1/8.12.8) with ESMTP id 10UAAqmE015160; Sat, 30 Jan 2021 13:10:57 +0300 Received: from oak.local (unknown [83.167.113.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by dragon.sai.msu.ru (Postfix) with ESMTPSA id 74A7077FB; Sat, 30 Jan 2021 13:10:53 +0300 (MSK) From: "Matwey V. Kornilov" To: Jean Delvare , Guenter Roeck , Javier Martinez Canillas , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING), linux-kernel@vger.kernel.org (open list) Cc: matwey.kornilov@gmail.com, "Matwey V. Kornilov" , linux-hwmon@vger.kernel.org (open list:HARDWARE MONITORING), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] hwmon: lm75: Use zero lm75_type for lm75 Date: Sat, 30 Jan 2021 13:10:38 +0300 Message-Id: <20210130101038.26331-1-matwey@sai.msu.ru> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a logical flaw in lm75_probe() function introduced in e97a45f1b460 ("hwmon: (lm75) Add OF device ID table") Note, that of_device_get_match_data() returns NULL when no match found. This is the case when OF node exists but has unknown compatible line, while the module is still loaded via i2c detection. arch/powerpc/boot/dts/fsl/p2041rdb.dts: lm75b@48 { compatible = "nxp,lm75a"; reg = <0x48>; }; In this case, the sensor is mistakenly considered as ADT75 variant. The simplest way to handle this issue is to make the LM75 code zero. Fixes: e97a45f1b460 ("hwmon: (lm75) Add OF device ID table") Signed-off-by: Matwey V. Kornilov --- drivers/hwmon/lm75.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index e447febd121a..3aa7f9454f57 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -25,12 +25,12 @@ */ enum lm75_type { /* keep sorted in alphabetical order */ + lm75 = 0, /* except of lm75 which is default fallback */ adt75, ds1775, ds75, ds7505, g751, - lm75, lm75a, lm75b, max6625, -- 2.26.2