From patchwork Thu Sep 24 14:00:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 7256951 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 28034BEEC1 for ; Thu, 24 Sep 2015 14:07:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 52205207C6 for ; Thu, 24 Sep 2015 14:07:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63D8A207A4 for ; Thu, 24 Sep 2015 14:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756447AbbIXOBj (ORCPT ); Thu, 24 Sep 2015 10:01:39 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:55594 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755850AbbIXOBK (ORCPT ); Thu, 24 Sep 2015 10:01:10 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NV600KMYPLWWF70@mailout1.w1.samsung.com>; Thu, 24 Sep 2015 15:01:08 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-b4-5604022491e4 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 06.D8.05269.42204065; Thu, 24 Sep 2015 15:01:08 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NV600IK6PLM8670@eusync4.samsung.com>; Thu, 24 Sep 2015 15:01:08 +0100 (BST) From: Andrzej Hajda To: linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Mark Brown , linux-spi@vger.kernel.org Subject: [PATCH 02/19] spi: davinci: fix handling platform_get_irq result Date: Thu, 24 Sep 2015 16:00:10 +0200 Message-id: <1443103227-25612-3-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1443103227-25612-1-git-send-email-a.hajda@samsung.com> References: <1443103227-25612-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjluLIzCtJLcpLzFFi42I5/e/4NV0VJpYwg9c/hS1urTvHarFxxnpW i6kPn7BZXN41h82i8eNNdou1R+6yO7B5bFrVyebRt2UVo8fnTXIBzFFcNimpOZllqUX6dglc Gd9anjAW9HFW7O56ytLAeIC9i5GTQ0LARGLz0hfMELaYxIV769m6GLk4hASWMkqcevkMymli kph78CMbSBWbgKbE3803wWwRAQWJzb3PWEGKmAXOMEo86/8GlhAW8JSYfWo6K4jNIqAq8Wjt FhYQm1fAWeL9oUusEOvkJE4emwxmcwq4SLyduokJxBYCqjlxZBbbBEbeBYwMqxhFU0uTC4qT 0nON9IoTc4tL89L1kvNzNzFCQufrDsalx6wOMQpwMCrx8M7UYQ4TYk0sK67MPcQowcGsJMLL 8R4oxJuSWFmVWpQfX1Sak1p8iFGag0VJnHfmrvchQgLpiSWp2ampBalFMFkmDk6pBsaJyxft 7Qvu23+2dsey2tnvGw7fe35I2nXVhluJzzoalc6ulmSyDW/g+WnW+2RqlLb+xXpVyWXbI4/f DLyc/LztzE+R1OCPPc7SLKcOfp1S1e7xtC92YSBzYZZof8BShU1/b02yNdw/bfaUTrZ3Lw6e nW2c3Chae/Ba0wwZ2Rv3/fQ4jrxZuma9EktxRqKhFnNRcSIAyy0yhRkCAAA= Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The function can return negative value. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107 Signed-off-by: Andrzej Hajda --- Hi, To avoid problems with too many mail recipients I have sent whole patchset only to LKML. Anyway patches have no dependencies. Regards Andrzej --- drivers/spi/spi-davinci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 3cf9faa..a85d863 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -992,11 +992,12 @@ static int davinci_spi_probe(struct platform_device *pdev) goto free_master; } - dspi->irq = platform_get_irq(pdev, 0); - if (dspi->irq <= 0) { + ret = platform_get_irq(pdev, 0); + if (ret == 0) ret = -EINVAL; + if (ret < 0) goto free_master; - } + dspi->irq = ret; ret = devm_request_threaded_irq(&pdev->dev, dspi->irq, davinci_spi_irq, dummy_thread_fn, 0, dev_name(&pdev->dev), dspi);