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 merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYShd-0000qD-GP for barebox@lists.infradead.org; Fri, 30 Oct 2020 11:36:18 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 30 Oct 2020 12:36:14 +0100 Message-Id: <20201030113614.9572-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] nfs: check return value of various rpc calls To: barebox@lists.infradead.org Q2hlY2sgbW9yZSBjYXJlZnVsbHkgZm9yIGZhaWxpbmcgcmVxdWVzdHMuIFRoaXMgaW1wcm92ZXMg dGhlIGVycm9yCm1lc3NhZ2Ugd2hlbiB0cnlpbmcgdG8gbW91bnQgYSBub24tZXhwb3J0ZWQgbmZz IGRpcmVjdG9yeSBmcm9tOgoKCW5mc19tb3VudF9yZXE6IGZpbGUgaGFuZGxlIHRvbyBiaWc6IDQ0 ODMxCgp0bwoKCW5mc19tb3VudF9yZXE6IE1vdW50aW5nIGdhdmUgZXJyb3IgTkZTM0VSUl9BQ0NF UygweGQpCgouCgpTaWduZWQtb2ZmLWJ5OiBVd2UgS2xlaW5lLUvDtm5pZyA8dS5rbGVpbmUta29l bmlnQHBlbmd1dHJvbml4LmRlPgotLS0KIGZzL25mcy5jIHwgOTEgKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKy0tLS0tLS0KIDEgZmlsZSBjaGFuZ2VkLCA4 MSBpbnNlcnRpb25zKCspLCAxMCBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9mcy9uZnMuYyBi L2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