From patchwork Sun Jan 6 08:37:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 154844 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2355902ljp; Sun, 6 Jan 2019 00:39:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN6vEiPTJL8h3vKEkL1xX1vczwsQ0qDstgHFNUTb8qQE5cLYjDfvr/V/7tMDfUjXx+5+w8nu X-Received: by 2002:a63:1f4e:: with SMTP id q14mr6850853pgm.88.1546763966593; Sun, 06 Jan 2019 00:39:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546763966; cv=none; d=google.com; s=arc-20160816; b=N+2FBun/Iy3i+wkUxp0/T66ttOF0nGRmZZfmZs6f67kq7oFK8ZDr8Q5kdPbgWEvrhe m3CyoCSRShAUGFNHCKBD+uOFjDMiiyTvKsff1narWgk+IbSDNkwVxUGQMELvT30p4gzs 5QRkhAtrmsOxSIwytJdAjaUfRbq0ZC9ykut2qUq3OQPlMaFJy5EUEozNdtuztXG88jLV uG1vGXLPpR9G8D4UCTEPY9ra/R6XG5r5J/Cmw+R0/NXnJrzfFZBuz8uBa6dyrUII2Smc 8iEjmbW25foHFaG0eUNDI56bPBItEPFOcarKu70y/KLdOtS5ziLR3jEVl5IyRpEi144s /fJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=icIkFjpedhaGa/ExI8QpSNW2jLu5Jj9xIiSk58yRb9A=; b=wiTs/7XHdg2IPX0UrqMSTpLw2A8jKvBYt9+NbVwn+WJQAoFYx/ky8sk7mV0VAhpHZe jEJp8Rbj6oyv1h+zcruTZeKW6/vC0eDSihJej8582iHGTDbmUYHIQdSBg+xBki1pQKfC 1XenUgVRwgs8Oi9SbE+0jhAZYxq4Ict6324EjIy7HR7HSg68MCsVcSOUUKDftsi57FZb 4Q9rg2N/uPpHRUkh/nPbNgnCrW8RxkT65x41RtYoSvTZumuiW/6O9NhTZFBGN20260Aa 5O42NjPU3+Igyl39auXz0l8B0TIQ4zYmYPw+rALYOjz/MwD0JilcKP6bw8h8HzyozuTQ E4sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si19322280plb.91.2019.01.06.00.39.26; Sun, 06 Jan 2019 00:39:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbfAFIjZ (ORCPT + 10 others); Sun, 6 Jan 2019 03:39:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:57178 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726431AbfAFIiE (ORCPT ); Sun, 6 Jan 2019 03:38:04 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DD781AC38; Sun, 6 Jan 2019 08:38:02 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-lpwan@lists.infradead.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andrea?= =?utf-8?b?cyBGw6RyYmVy?= , "David S. Miller" Subject: [PATCH lora-next 01/11] net: lora: sx125x: Abort on wrong version Date: Sun, 6 Jan 2019 09:37:44 +0100 Message-Id: <20190106083754.6004-2-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190106083754.6004-1-afaerber@suse.de> References: <20190106083754.6004-1-afaerber@suse.de> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This helps detect issues such as the concentrator being in reset. Enhance error output while at it. Signed-off-by: Andreas Färber --- drivers/net/lora/sx125x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.16.4 diff --git a/drivers/net/lora/sx125x.c b/drivers/net/lora/sx125x.c index 90e7cdb9d1a8..0228d1f887a0 100644 --- a/drivers/net/lora/sx125x.c +++ b/drivers/net/lora/sx125x.c @@ -195,9 +195,13 @@ static int __maybe_unused sx125x_regmap_probe(struct device *dev, struct regmap if (true) { ret = regmap_read(priv->regmap, SX1255_VERSION, &val); if (ret) { - dev_err(dev, "version read failed\n"); + dev_err(dev, "version read failed (%d)\n", ret); return ret; } + if (val != 0x21) { + dev_err(dev, "unexpected version: %u\n", val); + return -EINVAL; + } dev_info(dev, "SX125x version: %02x\n", val); }