From patchwork Mon Mar 6 12:58:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 64632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1831034wrd; Mon, 6 Mar 2023 05:11:29 -0800 (PST) X-Google-Smtp-Source: AK7set8DdUoqxnnsCbqwlqHF4vQjjMOKFeV3+fwEqP4J07i9XiE08Tw78Fcb4gOh0s0lzFjjpkwY X-Received: by 2002:a17:90a:db92:b0:237:44ad:5124 with SMTP id h18-20020a17090adb9200b0023744ad5124mr11236443pjv.42.1678108288549; Mon, 06 Mar 2023 05:11:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678108288; cv=none; d=google.com; s=arc-20160816; b=KSTueQMHCG/HWZhMAcFHmWfTDNidwPcwPNt1rWb4tWFYVC2+VmhiA+jwPXYGX118Sg AjWvQSQZG6fGBFoGHBiRjFn6J8TD43NFaWv6aiZ+2dLpP9EAePYiio0wYBDppR+s8yQG 7U+n4NLc9TieE9GpgqUCjog8Ic93PD1Ew5LANfqIcsg8u0+kTAkxwfzcCAraObKCLdlN +qWvhJ0BEQpYivSYQyYK/aBxm1JJ3/4w8sSWYf7+wgt0V37RfP96JV7r39hzM41hfIl3 vVOcwswnLUgXGCdF7msTaqJ84FlxvJ/NPiv/nQfhckULOLWW81v16UTCZuUuXalwh2Ij vxNw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VjUKX8vcOHRxfuq1rLlQX2Q888LcQ64xmxe+6S+e/IE=; b=n3IJfAM9Ymr7nqtzWB9Ma64NCquYhcxZVStRqNZQ8IswmPS+8q5DL5b6JxqM8Ris+q YE9p8v1jCQKeymCWPQftGMefQ4KhDcyky1M9mzKA9k1KTUm83lMlmYVFUN6P6xTNCoPK OpalIeFel/knMreM9jy4WBdDR6T2o5BqPQSd1HGX2LZjXRvnF6TF1dBLf/hQxuiQQ0RZ xNdFot3krhP8D+3w1SfV5qR7rrZ78gSgPCxXd4hdgmr2ChmRkcpWr9oXhjz5vBEML7Wt LDUVo9GhnTmO/1HHuCeqbt8N2DHZxP2oQIxAsS8jE0grdJcnPsFoWS0N8G38dvb2sdvo bFlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=remoxRjf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p14-20020a17090a680e00b002349fd50c3bsi11343707pjj.40.2023.03.06.05.11.15; Mon, 06 Mar 2023 05:11:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=remoxRjf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230348AbjCFM6a (ORCPT + 99 others); Mon, 6 Mar 2023 07:58:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbjCFM62 (ORCPT ); Mon, 6 Mar 2023 07:58:28 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3BD223137 for ; Mon, 6 Mar 2023 04:58:21 -0800 (PST) Received: from mwalle01.kontron.local. (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 3E19C166A; Mon, 6 Mar 2023 13:58:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1678107500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VjUKX8vcOHRxfuq1rLlQX2Q888LcQ64xmxe+6S+e/IE=; b=remoxRjffuVdFV7RP3A/DnTRNbgpNuzcP3/5Mg9FRfPXhjxTQZ50iPuDU7OZnQcfHyZ7zO 9E7JrxIJIKD7pqQim7XtEAG+cO3qoXl3QzBIxSExnODOS2nuzneBbUL8Z35SobE49Eik7+ ry9Ino+B/stNJLhVunGZmd6t+JJVAsfqqefv6K/tixr06EYzbzuwfxvqI1yvBHI/Zlhgtz Y6uNyLjCduevVlEnmfGrCoib/8UiZ+qK+YiMSRDCcaDCp75kLJBg4ltLf0zjAeSKb5oK4B dIdBBn5Zk4La6lL4Lj/8CTrMQVvXmJ9P970akTIj2U3/eVVBg5pyf1r23rvDWQ== From: Michael Walle To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Michael Walle Subject: [PATCH 4/4] mtd: core: prepare mtd_otp_nvmem_add() to handle -EPROBE_DEFER Date: Mon, 6 Mar 2023 13:58:05 +0100 Message-Id: <20230306125805.678668-4-michael@walle.cc> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230306125805.678668-1-michael@walle.cc> References: <20230306125805.678668-1-michael@walle.cc> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759624077000741630?= X-GMAIL-MSGID: =?utf-8?q?1759624077000741630?= NVMEM soon will get the ability for nvmem layouts and these might not be ready when nvmem_register() is called and thus it might return -EPROBE_DEFER. Don't print the error message in this case. Signed-off-by: Michael Walle --- drivers/mtd/mtdcore.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index d6675bf03557..4f9bd78bc6f9 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -952,8 +952,8 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) nvmem = mtd_otp_nvmem_register(mtd, "user-otp", size, mtd_nvmem_user_otp_reg_read); if (IS_ERR(nvmem)) { - dev_err(dev, "Failed to register OTP NVMEM device\n"); - return PTR_ERR(nvmem); + err = PTR_ERR(nvmem); + goto err; } mtd->otp_user_nvmem = nvmem; } @@ -970,7 +970,6 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) nvmem = mtd_otp_nvmem_register(mtd, "factory-otp", size, mtd_nvmem_fact_otp_reg_read); if (IS_ERR(nvmem)) { - dev_err(dev, "Failed to register OTP NVMEM device\n"); err = PTR_ERR(nvmem); goto err; } @@ -982,7 +981,7 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) err: nvmem_unregister(mtd->otp_user_nvmem); - return err; + return dev_err_probe(dev, err, "Failed to register OTP NVMEM device\n"); } /**