Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3698842pxv; Mon, 26 Jul 2021 09:40:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9l+vw6BxgrlbDNDIxQPJLvLwdTnXv0wyERdqCvb6blHUnNahjDX4ul2WRHgY+o3U6PSyM X-Received: by 2002:a17:906:368e:: with SMTP id a14mr18305408ejc.60.1627317516777; Mon, 26 Jul 2021 09:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627317516; cv=none; d=google.com; s=arc-20160816; b=AinNI12AJoJFBy/YyOHKCJXM+hVGpnJl9HKWWRZnaPkJz09AOeMCU0kPlh5OP5OAOS YP5sAcQcNg8wD8LsABtd2DLD30iMbuifgfjSvNrqtOSZ0TZrr+vzpoMHbelvaG6Js8zs kCz8Ezu3fHUUGdT/tNKkZLE5c2ufOFtoYLCSuLdrXsPCWqcYOgPdlJsxurycg79rTZOp Kgefdd9CNb2BWJEiTbenPn8kzTU+BBsEhuBAk4Z5jBfuaUV5CbxwdzSznQUC3MbHE2bk qA9VXBLUHZq68JAzaqwlPC3r0Qot9qO9vir/XwcZAI7FvnAf8WPBlB6b7logakGdpQeO DaQA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jldZiyz5YFoUepPcI9AjlkSnIKnLVI5UkgllXANbYs0=; b=gxKDjVBOWyXsjBz6uHzvfEslknVuSIUt7abj7LRly7JtUJAS5CX25cnF9uiNiQU1Bk RqPRtasMYonZ2x1WK9qSvQMzHaE7Pupg4JvXt1RkiJzQDbiNRigqMpyZI1mvKMQv5DFR RGQ5+sl2/VyoorpKwn4zQ7n3VCqvu3DPjF6bITs4dF7E8E2/TA4fvlt0Nt2WmTtIyo13 Mo4x1fKuFLwXBDYf1CETjyUrC19BUWHaDmB5WjJFBzv87JNkzWo7BwqcCSJjFyiFyLjk Jccofi+ErJjSL5c72ShcLzg9SdmLzzT9LgoJ3DObyAXiRPQb7jcRh4BtIWxBkVXauXZb kcwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QXoC/sS4"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i18si461363edc.507.2021.07.26.09.38.13; Mon, 26 Jul 2021 09:38:36 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QXoC/sS4"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240632AbhGZPzu (ORCPT + 99 others); Mon, 26 Jul 2021 11:55:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:52722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234865AbhGZPfP (ORCPT ); Mon, 26 Jul 2021 11:35:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA77560F5A; Mon, 26 Jul 2021 16:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627316143; bh=t1qrw3qqvDhAbr7/DTs8zeVeYBvUPo8sBxMfTjxJw+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QXoC/sS44RkfDnZiG5NaBbQeFNIVjpQWb/zQGGX3bPR45/l2RblhIKSDgs2+hP36i lCJwgos6WfjhIhlADUDzCAg5/oDZ3s+MFhIyU36fbquHkDDNovfwgW2sAXbTcQcGLg lzp3ACW4H1ZkUcFo+mxBjMtjdCD1OyrD5/6F/lGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Fomichev , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Bartosz Golaszewski Subject: [PATCH 5.13 205/223] misc: eeprom: at24: Always append device id even if label property is set. Date: Mon, 26 Jul 2021 17:39:57 +0200 Message-Id: <20210726153852.896480175@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153846.245305071@linuxfoundation.org> References: <20210726153846.245305071@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jérôme Glisse commit c36748ac545421d94a5091c754414c0f3664bf10 upstream. We need to append device id even if eeprom have a label property set as some platform can have multiple eeproms with same label and we can not register each of those with same label. Failing to register those eeproms trigger cascade failures on such platform (system is no longer working). This fix regression on such platform introduced with 4e302c3b568e Reported-by: Alexander Fomichev Fixes: 4e302c3b568e ("misc: eeprom: at24: fix NVMEM name with custom AT24 device name") Cc: stable@vger.kernel.org Signed-off-by: Jérôme Glisse Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman --- drivers/misc/eeprom/at24.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -714,23 +714,20 @@ static int at24_probe(struct i2c_client } /* - * If the 'label' property is not present for the AT24 EEPROM, - * then nvmem_config.id is initialised to NVMEM_DEVID_AUTO, - * and this will append the 'devid' to the name of the NVMEM - * device. This is purely legacy and the AT24 driver has always - * defaulted to this. However, if the 'label' property is - * present then this means that the name is specified by the - * firmware and this name should be used verbatim and so it is - * not necessary to append the 'devid'. + * We initialize nvmem_config.id to NVMEM_DEVID_AUTO even if the + * label property is set as some platform can have multiple eeproms + * with same label and we can not register each of those with same + * label. Failing to register those eeproms trigger cascade failure + * on such platform. */ + nvmem_config.id = NVMEM_DEVID_AUTO; + if (device_property_present(dev, "label")) { - nvmem_config.id = NVMEM_DEVID_NONE; err = device_property_read_string(dev, "label", &nvmem_config.name); if (err) return err; } else { - nvmem_config.id = NVMEM_DEVID_AUTO; nvmem_config.name = dev_name(dev); }