Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp632466pxj; Thu, 20 May 2021 18:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEdRNs+/vSmSDJcY4b7SSRVzB6b8oyo0krXHEYu6jCKeDyN4vO4FcQ2G8RcDrhuBE5HNeL X-Received: by 2002:a05:6638:120f:: with SMTP id n15mr522865jas.56.1621560537449; Thu, 20 May 2021 18:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621560537; cv=none; d=google.com; s=arc-20160816; b=nqqBcVmOdP7ow9dzgEmMjtAcTrnlGZOby2CRiuqbK1bZrOYBVPhz3qxmjK4dFMSP5/ cgXL23g8Q0r7cLBIWQtkxRH5N0hsPuLCwIFfogMPd89clfAbNwaxs06c0T/R//I3Vupr cIUpj3DNQdSkkshzfnRgtGRXy5Ob1pXAJZX086XNxZFZFGIvfpRs6dKUC/q6p8XZVkCb CPUNMoJGB8SSPvRAWRMRoykAv1oZkhCs8flZOoogd1tAQ1NS3zn9xrdO/QyCC5OJo7O7 cP5PSgCbXgd6xTxkyTGUb5ywwDyYkzr2PwtDyNkX0seMwyL1bjCnvyoQyPWEUbXEYPZP mgFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i5cTpjeywQc9SZMhgfIekMV1BZCYmWaPDZ6jmg1ciIo=; b=lTaSmYPHcxtH6Cdg+6zXEmG1TNs+/8U8G70ITsIvO32pNKW1Zfpk6JLe5ZkDUT5drv i3FhFNhjyTAwZMBYvQNLiJxwH5TKUny4+F/XU7L/CVPHuKIijhIc99KOz9OsorkvQR02 mzKc4O3T4xA+kq3L6ylIIGG2xDD4/+vMBex8l0HBY+AL5o9k2yYVr1sHj52BgmifrpRk cCxismUoUZ3k0dJqCBw7i3Yp8rUZnamL9qCM9nULopJ2RKYdWx/LiupDnXnnKFDxek62 AbgQuDOjv2/Fa5HMWr4oqAU69oEGcYN5sTYK5AE6gYsFDxRn+pThYJD0xfvvUvc5xJnL 1J8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U7kST1P6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si4122572ilh.102.2021.05.20.18.28.42; Thu, 20 May 2021 18:28:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U7kST1P6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241359AbhETLih (ORCPT + 99 others); Thu, 20 May 2021 07:38:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:37860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240613AbhETLTA (ORCPT ); Thu, 20 May 2021 07:19:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3977B61D6F; Thu, 20 May 2021 10:10:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505408; bh=bxCx1MAP2+M9YGiGyUZpSHuw78e7yD2VQk4Y+7qmHn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U7kST1P6Owc1ro3/XH38syHVrindUTGFOSoVa2k7igsAmn8/SQ3MzDyAojFG8vveV Yq5jY6jEX/EobfMAU2Lfe2+tBJya3CfOKXNFjMX4wF8E1C+D27WvAn7NAKOLbcsfQ6 fu76DmGIcsg0glMn7SlnpaIIN+JuKKGSeex5lpqk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Wolfram Sang , Sasha Levin Subject: [PATCH 4.4 122/190] i2c: jz4780: add IRQ check Date: Thu, 20 May 2021 11:23:06 +0200 Message-Id: <20210520092106.238198076@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov [ Upstream commit c5e5f7a8d931fb4beba245bdbc94734175fda9de ] The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s. Fixes: ba92222ed63a ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-jz4780.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index ba3b94505c14..d80cee068bea 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c @@ -754,7 +754,10 @@ static int jz4780_i2c_probe(struct platform_device *pdev) jz4780_i2c_writew(i2c, JZ4780_I2C_INTM, 0x0); - i2c->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + goto err; + i2c->irq = ret; ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, dev_name(&pdev->dev), i2c); if (ret) -- 2.30.2