From patchwork Fri Apr 6 20:50:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karthikeyan Ramasubramanian X-Patchwork-Id: 10327567 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 0EEAC6038F for ; Fri, 6 Apr 2018 20:51:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2DA4296D0 for ; Fri, 6 Apr 2018 20:51:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0F67296C9; Fri, 6 Apr 2018 20:51:27 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, 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 BE58D296F9 for ; Fri, 6 Apr 2018 20:51:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751952AbeDFUvK (ORCPT ); Fri, 6 Apr 2018 16:51:10 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33838 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751410AbeDFUvJ (ORCPT ); Fri, 6 Apr 2018 16:51:09 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 03A1460364; Fri, 6 Apr 2018 20:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523047869; bh=5K4PjWIu6KrTYDjm5mTjOzJTThQPRoKSC25HXY1lw3E=; h=From:To:Cc:Subject:Date:From; b=OocOuDUtKTvwwm9BluDtF96dmWSATqsreLBI6qC1I45Qy+PffiD0h700VuB8G1/RI av+3BIM7meEgpXWWX37WRScAHhqmBWnpJ+yquPPrtdDa8OWpPr2aVTHK3KtOL41XHW orvbczN7wkAN23TxSKCaSPcUKDm0OPKNIuX06ExU= Received: from codeaurora.org (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kramasub@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id ADEFF60316; Fri, 6 Apr 2018 20:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523047868; bh=5K4PjWIu6KrTYDjm5mTjOzJTThQPRoKSC25HXY1lw3E=; h=From:To:Cc:Subject:Date:From; b=EpIV1Aiexx8VA7PJOxzdblGMfjGxbCAW1QmEJUwEx7M8tx6UMbJLB6pwTmpBHs3uh Y5NxzKWS+itpb8M3Xl2w5brsQA0rKI/pSFdgZ9BjnDAPKWgQbSV/NarGP/wjHFdNur FoIJiQSYa3fxSvJUOkXvRdp7U+pdyp2WaqJQPhO4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org ADEFF60316 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kramasub@codeaurora.org From: Karthikeyan Ramasubramanian To: gregkh@linuxfoundation.org, jslaby@suse.com Cc: Karthikeyan Ramasubramanian , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, girishm@codeaurora.org, sdharia@codeaurora.org, dan.carpenter@oracle.com Subject: [PATCH] tty: serial: qcom_geni_serial: Use signed variable to get IRQ Date: Fri, 6 Apr 2018 14:50:59 -0600 Message-Id: <1523047859-9543-1-git-send-email-kramasub@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The platform_get_irq can return error. Assigning the return value to an unsigned variable and checking it for negative value will always return false. Use an intermediate signed variable to get IRQ information, check for any error and then assign it to 'irq' variable inside uart_port structure. Signed-off-by: Karthikeyan Ramasubramanian Reviewed-by: Stephen Boyd --- drivers/tty/serial/qcom_geni_serial.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 65ff669..a1b3eb0 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -1022,6 +1022,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) struct qcom_geni_serial_port *port; struct uart_port *uport; struct resource *res; + int irq; if (pdev->dev.of_node) line = of_alias_get_id(pdev->dev.of_node, "serial"); @@ -1061,11 +1062,12 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; - uport->irq = platform_get_irq(pdev, 0); - if (uport->irq < 0) { - dev_err(&pdev->dev, "Failed to get IRQ %d\n", uport->irq); - return uport->irq; + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, "Failed to get IRQ %d\n", irq); + return irq; } + uport->irq = irq; uport->private_data = &qcom_geni_console_driver; platform_set_drvdata(pdev, port);