From patchwork Mon Sep 21 13:33:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 7231021 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@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 5F8EBBEEC1 for ; Mon, 21 Sep 2015 13:52:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A7A42076D for ; Mon, 21 Sep 2015 13:52:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F37320764 for ; Mon, 21 Sep 2015 13:52:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932099AbbIUNv3 (ORCPT ); Mon, 21 Sep 2015 09:51:29 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:43643 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932085AbbIUNgR (ORCPT ); Mon, 21 Sep 2015 09:36:17 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NV100C1S4GE8J40@mailout3.w1.samsung.com>; Mon, 21 Sep 2015 14:36:14 +0100 (BST) X-AuditID: cbfec7f5-f794b6d000001495-31-560007ce4444 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id FC.57.05269.EC700065; Mon, 21 Sep 2015 14:36:14 +0100 (BST) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NV100LNT4DTKI10@eusync3.samsung.com>; Mon, 21 Sep 2015 14:36:14 +0100 (BST) From: Andrzej Hajda To: linux-kernel@vger.kernel.org Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , Matt Mackall , Herbert Xu , linux-crypto@vger.kernel.org Subject: [PATCH 10/38] hwrng: fix handling platform_get_irq Date: Mon, 21 Sep 2015 15:33:42 +0200 Message-id: <1442842450-29769-11-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> References: <1442842450-29769-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmluLIzCtJLcpLzFFi42I5/e/4Vd1z7AxhBl9OS1jcWneO1WLjjPWs Ft2vZCzu3/vJZHF51xw2i7VH7rJbLNjWx+jA7rHtgKpH35ZVjB59LzcwenzeJBfAEsVlk5Ka k1mWWqRvl8CVMfnKIuaCNRwVt/5aNzD+Z+ti5OSQEDCRmH6ziR3CFpO4cG89UJyLQ0hgKaPE +sszmSCcJiaJ1X23WUCq2AQ0Jf5uvgnWLSKgILG59xkrSBGzwA9GiScbbwCN4uAQFrCWOLE3 FaSGRUBVYsqns4wgYV4BF4lvS2IhlslJnDw2mRXE5gQKHzj4BWy8kICzxIElR5gmMPIuYGRY xSiaWppcUJyUnmukV5yYW1yal66XnJ+7iRESRF93MC49ZnWIUYCDUYmH11Hgf6gQa2JZcWXu IUYJDmYlEV6dWUAh3pTEyqrUovz4otKc1OJDjNIcLErivDN3vQ8REkhPLEnNTk0tSC2CyTJx cEo1MJZd2ONxO9h+X8bURMZFvceeJH7a4Xy+V3Ki/7G5ZzxW5Sxc+Xnxj/wLTh7CZR8d76w/ a81ZNVXC0uhkK9O+k9HWyikJCzN7kmMy5pzwvKe62mBv6In3jtMmdrs9fVKeedvlk3XHDXOb ufbmRzf+PcGw6cbbuOV7j/W7Py0/4B9S5JVzMX5b6h0lluKMREMt5qLiRABBlZhUHgIAAA== Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@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/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Signed-off-by: Andrzej Hajda --- drivers/char/hw_random/xgene-rng.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/xgene-rng.c b/drivers/char/hw_random/xgene-rng.c index c37cf75..3c77645 100644 --- a/drivers/char/hw_random/xgene-rng.c +++ b/drivers/char/hw_random/xgene-rng.c @@ -344,11 +344,12 @@ static int xgene_rng_probe(struct platform_device *pdev) if (IS_ERR(ctx->csr_base)) return PTR_ERR(ctx->csr_base); - ctx->irq = platform_get_irq(pdev, 0); - if (ctx->irq < 0) { + rc = platform_get_irq(pdev, 0); + if (rc < 0) { dev_err(&pdev->dev, "No IRQ resource\n"); - return ctx->irq; + return rc; } + ctx->irq = rc; dev_dbg(&pdev->dev, "APM X-Gene RNG BASE %p ALARM IRQ %d", ctx->csr_base, ctx->irq);