Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3721163pxt; Tue, 10 Aug 2021 09:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTtrZJzSuouUa4egbUw3G5jD/Loi3brIL84+DrdiHzVQFra8E+n8pe8mA8q5RmGG9xxidK X-Received: by 2002:a17:906:5a98:: with SMTP id l24mr4667410ejq.540.1628614069164; Tue, 10 Aug 2021 09:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628614069; cv=none; d=google.com; s=arc-20160816; b=z4/QDIZlzCNlfExIQb0QxTHpXruR8NsaThMtUJZiCfoblE35vg4LUO++zuOYi7UFow gK6xbJs7TKFTTIaKlg5l1maBqnXZwaFyT+PAtD3m5XcTaUvTITETVlULFswLH0DmW7N6 +1eKMaerW4qnD4d9t8POShfH77yrykyrlJs6oU9qVm+QREpApouEHktvCZ3E1FDBsrp8 LYDpXtjWmGUXYzapPBfj46wRBP58/mTuHLZsk9IBYhKPH3XKWmhDuVFYZvVWr8nWUYz7 WooNwmv34SkfymKzcu38WfwQa6u8fIT1jQ03bacOozIJrxm9MCDKZV7EvkNOz3lJ37S4 D4lQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=1IvooYq8Yem5dV4nvC50nzcM/pns/C6jIbPJ9hHA2Q8=; b=AyCqkjdlKgX0a1YVmZqkF824YRQ3yz7goL6W+8i50ZutMcOx7WUAcwdNgZv1DrUir2 KcLSQKbaoByjUx0B5icdd50UjMxQNpdDFHY8DDIgsrm6bTDVJdY52Qhrvhmrq0AuJABw tdgSFPnnuLhlgefH3iHljrX/GHrW9JEUcN9/+9d/vPo33y4thZPUCgaW0mPiSW5MNQcx Km3wuhtHZVRhumkD/eYjE+09NK5xqVdUqHDMRplbEd7IX/lwXOHnLtS0/iNl2MOnsfWD MRGhaTR/Am35ivG6GuxtOEFIQ7NFOcxyXsGqa2RTQ4PZxqhcgB/8kNVo9cLg3o3VwNVq vEog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="c+b/t7zB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si10655467edw.68.2021.08.10.09.47.24; Tue, 10 Aug 2021 09:47:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="c+b/t7zB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236108AbhHJQl3 (ORCPT + 99 others); Tue, 10 Aug 2021 12:41:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40345 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236059AbhHJQl3 (ORCPT ); Tue, 10 Aug 2021 12:41:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628613666; 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; bh=1IvooYq8Yem5dV4nvC50nzcM/pns/C6jIbPJ9hHA2Q8=; b=c+b/t7zBNoZJ7bT7QZ1e4LoIoweS11RAqEEr9WI3X9uQ0pHTaKQPImyZ43mD6hF20+aPQP 9vf2ZLIvoyTy0293iKfbJPGoK2mj23CKRuTdasl7O1Tv5Qiu+nk4vqbZGbAmxL1pbbA8J2 +nkuZywBTzsmEL70E4GV571OS94hhZY= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-v_PpvmJ-Ori64KN2mNUPaw-1; Tue, 10 Aug 2021 12:41:05 -0400 X-MC-Unique: v_PpvmJ-Ori64KN2mNUPaw-1 Received: by mail-oi1-f197.google.com with SMTP id u77-20020acac4500000b029025c7e6f8b64so7331313oif.6 for ; Tue, 10 Aug 2021 09:41:04 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=1IvooYq8Yem5dV4nvC50nzcM/pns/C6jIbPJ9hHA2Q8=; b=Pdlb+OoxrZCOkd8YD/y47pXfmxwMLz2Np737v0XoI3bRBoj8L8yV0XERjMczNrIDAe oyHXViInG6UNZIbJbpIKeBLNSuZewy3735x8X9ZhaRSvAtkcvmGCfCZfBceLw/91VA0y giKsiBRDeOfPILvp6pJ3uSKtBIlgQPSe7rnZcyc/V/Pk2azgQ08d6C5BfXHL6AhBZ9z4 FqRj3FiY4KL/jjHtgtz0itnhS2LHBQM7xMF4CrnLGWiwLr/GfihABE3OHIn+WFtp/7fb FfkjLx8OHGZccVM7aTYGim62vuEy2mWOnhai6Na16ggnAPTqkliCyKjwFQpiuFEqUx/9 aZIA== X-Gm-Message-State: AOAM530avWK2UlPS3iDaZpIYORreCxebVNG5tJuVm/ilPzpNwxJ6Aj0s 1e2gLUdQf3IrXKCCL/bxp8Uh92oKoXIttXMS1UfZ4bpZ/nl0trWRtUlldAY2t0QCd2SBPLWzB3R /omFg2RkLvPrYePRz5gi732fq X-Received: by 2002:a9d:7f86:: with SMTP id t6mr20468920otp.269.1628613664396; Tue, 10 Aug 2021 09:41:04 -0700 (PDT) X-Received: by 2002:a9d:7f86:: with SMTP id t6mr20468906otp.269.1628613664226; Tue, 10 Aug 2021 09:41:04 -0700 (PDT) Received: from localhost.localdomain.com (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id u136sm250903oie.44.2021.08.10.09.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Aug 2021 09:41:03 -0700 (PDT) From: trix@redhat.com To: mdf@kernel.org, p.pisati@gmail.com, atull@kernel.org, gregkh@linuxfoundation.org Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, Tom Rix , Dan Carpenter Subject: [PATCH] fpga: machxo2-spi: return an error on failure Date: Tue, 10 Aug 2021 09:40:36 -0700 Message-Id: <20210810164036.922830-1-trix@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix Reported problem drivers/fpga/machxo2-spi.c:229 machxo2_write_init() warn: missing error code 'ret' drivers/fpga/machxo2-spi.c:316 machxo2_write_complete() warn: missing error code 'ret' Earlier successes leave 'ret' in a non error state, so these errors are not reported. So set ret to -EINVAL before going to the error handler. Fixes: 88fb3a002330 ("fpga: lattice machxo2: Add Lattice MachXO2 support") Reported-by: Dan Carpenter Signed-off-by: Tom Rix --- drivers/fpga/machxo2-spi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/fpga/machxo2-spi.c b/drivers/fpga/machxo2-spi.c index 1afb41aa20d71..b4a530a31302f 100644 --- a/drivers/fpga/machxo2-spi.c +++ b/drivers/fpga/machxo2-spi.c @@ -225,8 +225,10 @@ static int machxo2_write_init(struct fpga_manager *mgr, goto fail; get_status(spi, &status); - if (test_bit(FAIL, &status)) + if (test_bit(FAIL, &status)) { + ret = -EINVAL; goto fail; + } dump_status_reg(&status); spi_message_init(&msg); @@ -313,6 +315,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr, dump_status_reg(&status); if (!test_bit(DONE, &status)) { machxo2_cleanup(mgr); + ret = -EINVAL; goto fail; } -- 2.26.3