From patchwork Sat Aug 26 10:47:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 719387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85A23C83F11 for ; Sat, 26 Aug 2023 10:48:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232443AbjHZKsM (ORCPT ); Sat, 26 Aug 2023 06:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232410AbjHZKsA (ORCPT ); Sat, 26 Aug 2023 06:48:00 -0400 Received: from out203-205-221-209.mail.qq.com (out203-205-221-209.mail.qq.com [203.205.221.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CABF6210B; Sat, 26 Aug 2023 03:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1693046872; bh=5UEV9iQkXoRv1ZtDwjdYwDN72SNM+l48hXqNkJ9a9lw=; h=From:To:Cc:Subject:Date; b=hgUIcYrQJi305OII8XWsT0Mtsso55kouCowVCizAJNNM4/K1GZ3Q2zb6pGXsxnvUf NsvteS+38gnJxcNz6CW0jIUInRn3Mx/4QHJmxQ2FNGZ4y+1WSs+DylnIDRNsUOrLvo W68cD5JlCKZuOjwoyrOBTj9dX+AM5oKdIknUvrS8= Received: from KernelDevBox.byted.org ([180.184.51.142]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id BF132ADC; Sat, 26 Aug 2023 18:47:49 +0800 X-QQ-mid: xmsmtpt1693046869t422jo22r Message-ID: X-QQ-XMAILINFO: M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Q-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Zhang Shurong To: quic_schowdhu@quicinc.com Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Shurong Subject: [PATCH] usb: misc: eud: Fix missing IRQ check in eud_probe() Date: Sat, 26 Aug 2023 18:47:47 +0800 X-OQ-MSGID: <20230826104747.2264114-1-zhang_shurong@foxmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This func misses checking for platform_get_irq()'s call and may passes the negative error codes to request_irq(), which takes unsigned IRQ #, causing it to fail with -EINVAL, overriding an original error code. Fix this by stop calling request_irq() with invalid IRQ #s. Fixes: 9a1bf58ccd44 ("usb: misc: eud: Add driver support for Embedded USB Debugger(EUD)") Signed-off-by: Zhang Shurong --- drivers/usb/misc/qcom_eud.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c index 7f371ea1248c..b33c615a2037 100644 --- a/drivers/usb/misc/qcom_eud.c +++ b/drivers/usb/misc/qcom_eud.c @@ -204,7 +204,12 @@ static int eud_probe(struct platform_device *pdev) if (IS_ERR(chip->mode_mgr)) return PTR_ERR(chip->mode_mgr); - chip->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + + chip->irq = ret; + ret = devm_request_threaded_irq(&pdev->dev, chip->irq, handle_eud_irq, handle_eud_irq_thread, IRQF_ONESHOT, NULL, chip); if (ret)