From patchwork Fri Nov 4 10:30:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGFsIFZva8OhxI0=?= X-Patchwork-Id: 9412411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 31E45601C2 for ; Fri, 4 Nov 2016 10:31:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 063FF2ACCB for ; Fri, 4 Nov 2016 10:31:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EDC532AD3A; Fri, 4 Nov 2016 10:31:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 858462ACCB for ; Fri, 4 Nov 2016 10:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761144AbcKDKay (ORCPT ); Fri, 4 Nov 2016 06:30:54 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35363 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760835AbcKDKau (ORCPT ); Fri, 4 Nov 2016 06:30:50 -0400 Received: by mail-wm0-f65.google.com with SMTP id 68so3202483wmz.2 for ; Fri, 04 Nov 2016 03:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RSIlk5nq0ad4SzcDIlkletZcWVCe+5FCRuow0fUWu4o=; b=rTqdUdmuYzXCu9eLpO5eMwi4RCpGYeFW1jeziyF0auMzQajH1V76GY1TkDLzgJmdtN DZDzV7Qz98f7tI1vYHT0oCQQ5A1TNfdnnawpLSlJwzL7PAye/c5spsE9cxj2oZyxihdW zSmuxYhxjbA+yqLcYun/7+N2BxPQTmsZDeI+OK+ufS4nLNQQUuteei17N2dcwttdaM8g UlK18+HnYHePMxAEvs1RK2tOuBUMOXTi+Uw/HLDdDYOSnIitn+R8/Zqfrd/Mnw4TCn0Y eAdN4du6MGztg33YKaxVVi9JgqspcO5nJJFCm9DRkfsXPUheXAILVrEeZ9gvNJlUdmLN ZCsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RSIlk5nq0ad4SzcDIlkletZcWVCe+5FCRuow0fUWu4o=; b=QNoAz3Ji6ye1m7Nx8xzdxsKGo1gbemyzSiEpuu668AFSm+LG/Vyq8Ef798u/FHd6zu 7+GOlPmOoKqOD+J1qUR9Gq6BnQ7KrqfFxvTjuc5shYIelu+kbwiKj9KOYTR572+vSny6 vndoH8FUor8AEfZ2446uJviP4zUchjVQrhpX4TdAwK1wZs+Z4LqOL8puyLxdMITh+eK+ bpZXMUo5eC43qo4M538Lh2L3h77Q3AGqteEqvQNN4fzWgh16W4H5yNCNBLWXu88epCLJ QDIKXk9zsSMjqq4OXnsKE3WKa/9xCmYdGhMn+FMLMfV45TGLbeuxFVCdDugCowfSrx5r 5FLw== X-Gm-Message-State: ABUngvfON+sf7tMhOaf6Dm7ox1Vy43KLyZ4RGb0EDxnAMsyL2g1ONeMJ1EOIuBHTcITyIw== X-Received: by 10.28.154.86 with SMTP id c83mr2537479wme.23.1478255449193; Fri, 04 Nov 2016 03:30:49 -0700 (PDT) Received: from tixo.felk.cvut.cz ([2001:718:2:1654:d8d3:5700:1c0f:3333]) by smtp.gmail.com with ESMTPSA id u64sm3859912wmd.6.2016.11.04.03.30.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Nov 2016 03:30:48 -0700 (PDT) From: =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= To: broonie@kernel.org Cc: linux-spi@vger.kernel.org, stillcompiling@gmail.com, =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= Subject: [PATCH] spi: spidev_test: Fix input file check when transferring file Date: Fri, 4 Nov 2016 11:30:03 +0100 Message-Id: <1478255403-11149-1-git-send-email-vokac.m@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check the input file fd instead of spidev fd. The spidev fd is supposed to be OK otherwise the transfer_file() function would not be called at all. Signed-off-by: Michal Vokáč Reviewed-by: Joshua Clayton --- tools/spi/spidev_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/spi/spidev_test.c b/tools/spi/spidev_test.c index f046b77..816f119 100644 --- a/tools/spi/spidev_test.c +++ b/tools/spi/spidev_test.c @@ -315,7 +315,7 @@ static void transfer_file(int fd, char *filename) pabort("can't stat input file"); tx_fd = open(filename, O_RDONLY); - if (fd < 0) + if (tx_fd < 0) pabort("can't open input file"); tx = malloc(sb.st_size);