Received: by 10.192.165.156 with SMTP id m28csp521245imm; Wed, 11 Apr 2018 03:06:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+OJ5h2j2oxRpcbWc3e1bNF1FXvL2ry6n6nJ29yMHtTARipU6A6auQQyJhrENSXoEgFJEko X-Received: by 2002:a17:902:20eb:: with SMTP id v40-v6mr4345235plg.277.1523441167767; Wed, 11 Apr 2018 03:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523441167; cv=none; d=google.com; s=arc-20160816; b=kMSdS6PAh+eZaoT5S1Ua2Lo+oR9/J15GL4kJTC4rtHfEH7pNOFqJhq5drxeAlx8nAc FkOdEqs2joS8MYuXfE4s8OJxG3QBLBX1CybT48NGPUB0plhfLkLVzl+SVnZylUUwua+D qRImqhojI9MndogSs9ebxzJNBpI4Xm4roTwIzTo/AYZpGq9nfey68Qxekj8Eat30C1OD Y014oGZ1EFr1EtvgdVd3y70puDlP5/jjAwULOCL14JsFERTfbekInqt9KkQWzNGSvG81 Zlcsv0m8ZuXrNqzmkA00UKEIvP2t0MKDh9tZUKYqzdrT0lKDRnWl3sBTSB+0zlQTLSMb 00qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature:arc-authentication-results; bh=KCKLdsg6UYj1ffWQ0HSxrZ1tILdTvaQIldSDtXox1aA=; b=NRT8YFREsTq60xy/5nTUsbBcB4jV/CfG5p8xeNvi9cNYQIb1t46B9O9AXi2M/sMATR ujfVZ8ecMggJHVqXQrF4ExjtHKPcdrGiqyLb/ofa5bZufjAP6kMSonQL220mKW1uaVdQ u1/cpvLiPeMiXyxhcfIcvJQcSUFNTeGFckfiCAmt26XuQYWqpybVZNkSyyiArAV5VJ+4 UBHitpzCH9192PwM0dkhUBRA2NTZNr+jLE4lmbecwrBUdVr7UD8rpt7UBuusge0vOmV5 E/derH/t2WzEECqTOSqhVwI7jHJX5e4OYApl4vINp7cNzhl2sBrwK+KZkmpVKCdlhyy6 2wAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@raspberrypi.org header.s=pp header.b=lI5JBRIv; dkim=pass header.i=@raspberrypi-org.20150623.gappssmtp.com header.s=20150623 header.b=UsgR95CQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 l30si523214pgc.56.2018.04.11.03.05.30; Wed, 11 Apr 2018 03:06:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@raspberrypi.org header.s=pp header.b=lI5JBRIv; dkim=pass header.i=@raspberrypi-org.20150623.gappssmtp.com header.s=20150623 header.b=UsgR95CQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752652AbeDKJ7Z (ORCPT + 99 others); Wed, 11 Apr 2018 05:59:25 -0400 Received: from mx07-00252a01.pphosted.com ([62.209.51.214]:16541 "EHLO mx07-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751961AbeDKJ7X (ORCPT ); Wed, 11 Apr 2018 05:59:23 -0400 Received: from pps.filterd (m0102628.ppops.net [127.0.0.1]) by mx07-00252a01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3B9wEek030656 for ; Wed, 11 Apr 2018 10:59:21 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=from : to : cc : subject : date : message-id; s=pp; bh=KCKLdsg6UYj1ffWQ0HSxrZ1tILdTvaQIldSDtXox1aA=; b=lI5JBRIvnSpExvUN45mAWkCBmrFfFW9ZftZjxHwX2+CJ7QHmFafNQqx8NHstSw+boH9x 60GTeEdoZY4L9cgvs90yGsfP2780fSy1NbNHRHHujurbt955V1VtBeyrqhNDTpb8IY1P pCfCMBBYANaEDmvngl2LtmAQbNB45B6EqU3LYXIQc32dhFIp6hqn7O0z519hnNArHaUa zUnyhrCUE6JRGSS1ePUjG2AcLQNveEkQhT/piGdUJIqe7kacpnlMJbvSSnGUtegCt1Qn S86wvPfjOx9TI/ouR27xsKvMrsBOwUAjbRQe9LhOkntu2tfB5fS40/7eHLJl9huO/+/Z eQ== Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) by mx07-00252a01.pphosted.com with ESMTP id 2h6s4ka0nx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Wed, 11 Apr 2018 10:59:21 +0100 Received: by mail-wm0-f69.google.com with SMTP id v189so850722wmf.4 for ; Wed, 11 Apr 2018 02:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=KCKLdsg6UYj1ffWQ0HSxrZ1tILdTvaQIldSDtXox1aA=; b=UsgR95CQkPE5cblSbnTq1OVKLx76uDhZ3UNHld8gzfES/ZoUUKn2mNBGCifJK8WKcQ gGIswsoLdnE/Cd0FGwWxAUhIjHi+gQPPRPpmKehe7kRMsBxY1kwMJ23fD3/RNjHGUXc4 t9Os/Mah+5VzapQ41Oh/tMAEsVNcTbWECpfxbK9E5VMsUIIUsIyt+DapPGPJBaldq1+5 7Vgt/wnTXWRlB8t7D5QjEdUmuRRCHRYsS6ElNgkf+E87nJBmGXeRVF76vZ4Q6cZMkXw0 2fUWTBr4qLgUpLn/ft8ndLyYRSwOai3Zbil6KtVtBCnr9vtjg+iyvH2vf3o2P5kYOjmS sjgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=KCKLdsg6UYj1ffWQ0HSxrZ1tILdTvaQIldSDtXox1aA=; b=GIRBoO6WTikVs4xDJb/w0828+giqRWDNulHh0EmUR3tYFjYW4edLBbu0TmEJHAcnbC gFGk+91qv5Ypbn6p3+YB46dIyTaKRRsQClIQZzovdkwh4E4SQBPpvf9MOnB1g77E81n8 DQug0PbRre2gm6zSQQVsWMWQln8PCI63LfC8PUVt3eoAS8snD0aRUGRzKj39H9GdFk0m oLLT4p33nSOe48S5NzO4IjL7etvKMdaEe7h8gcm4nUYEbcsJthnhhvxpRj/1Gvfg9FU6 pCIZ8mo+RXsFf/q5xPMJx/BZhvErHdSG3U5D6e/V0DeJQBmwId+qTThU/rWUQW7igxo/ 3BMA== X-Gm-Message-State: ALQs6tBLgrcYT4uXawjbbwTt9yDfhpADhztfsaPYsXovKZ2Hol57THOT 82XDQyGXUGV++ZIGDhiNBKLzJJYqWelubWiXV+gQzZwJAa5rT6I7zdXTJae/rhgQ0Jz/zU/XAuj DVtyClO7sf4RO9rBgpXHUSrIN X-Received: by 10.28.193.11 with SMTP id r11mr2318091wmf.90.1523440761243; Wed, 11 Apr 2018 02:59:21 -0700 (PDT) X-Received: by 10.28.193.11 with SMTP id r11mr2318085wmf.90.1523440761079; Wed, 11 Apr 2018 02:59:21 -0700 (PDT) Received: from buildbot.pitowers.org ([2a00:2381:fdf7:14:1c94:2800:3cf2:4519]) by smtp.gmail.com with ESMTPSA id x9sm1416169wrb.18.2018.04.11.02.59.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 02:59:20 -0700 (PDT) From: Phil Elwell To: Woojung Huh , Microchip Linux Driver Support , netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Phil Elwell Subject: [PATCH] lan78xx: Correctly indicate invalid OTP Date: Wed, 11 Apr 2018 10:59:17 +0100 Message-Id: <1523440757-127451-1-git-send-email-phil@raspberrypi.org> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-11_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org lan78xx_read_otp tries to return -EINVAL in the event of invalid OTP content, but the value gets overwritten before it is returned and the read goes ahead anyway. Make the read conditional as it should be and preserve the error code. Signed-off-by: Phil Elwell --- drivers/net/usb/lan78xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index 55a78eb..32cf217 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -928,7 +928,8 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset, offset += 0x100; else ret = -EINVAL; - ret = lan78xx_read_raw_otp(dev, offset, length, data); + if (!ret) + ret = lan78xx_read_raw_otp(dev, offset, length, data); } return ret; -- 2.7.4