From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eHpRU-0006Q6-Fo for barebox@lists.infradead.ORG; Thu, 23 Nov 2017 11:13:20 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Thu, 23 Nov 2017 12:12:35 +0100 Message-Id: <20171123111237.10245-3-u.kleine-koenig@pengutronix.de> In-Reply-To: <20171123111237.10245-1-u.kleine-koenig@pengutronix.de> References: <20171122102231.16872-1-u.kleine-koenig@pengutronix.de> <20171123111237.10245-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 9/6] net/e1000: don't access the (simulated) eeprom when it is invalid To: barebox@lists.infradead.org Cc: Andrey Smirnov VGhlIHNoYWRvdyBSQU0gdGhhdCBpcyB1c2VkIHRvIHNlcnZlIHJlYWQgcmVxdWVzdHMgZnJvbSB0 aGUgZWVwcm9tCmludGVyZmFjZSBpc24ndCB2YWxpZCBpbiBhbGwgY2FzZXMuIENhdGNoIHRoZXNl IGJ5IHJldHVybmluZyBhbiBlcnJvciBpbgp0aGUgZWVwcm9tIHJlYWQgZnVuY3Rpb24gYW5kIG1h a2UgZWVwcm9tIHZhbGlkYXRpb24gZGVwZW5kYW50IG9uCndvcmtpbmcgYWNjZXNzLgoKU2lnbmVk LW9mZi1ieTogVXdlIEtsZWluZS1Lw7ZuaWcgPHUua2xlaW5lLWtvZW5pZ0BwZW5ndXRyb25peC5k ZT4KLS0tCiBkcml2ZXJzL25ldC9lMTAwMC9lMTAwMC5oICB8ICAzICsrKwogZHJpdmVycy9uZXQv ZTEwMDAvZ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