Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4626166pxj; Wed, 12 May 2021 09:31:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDKhBROOAjhsKnk9TfqOJx9auEHIgsEwnm1fklyCltsx9gX1/9ezsrfwbLMxR7x4ru1Zdh X-Received: by 2002:a17:907:a076:: with SMTP id ia22mr38290298ejc.233.1620837074364; Wed, 12 May 2021 09:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837074; cv=none; d=google.com; s=arc-20160816; b=mgsm3QdiMfsfWjOwGxXdf8u4RFnUmLSJdcShVnKCzHsODoEySYsUepCUTvTglhg+O9 QaAWJR2/nesbJH1BrmQ5TDU+gH69FjEUDn/mD2uB2f/wgZoUX+xUZJhxNt66BcDmVCLj GjpXgG5MVBhUpQ7zEfM95IqYjNUmZYMroIr0PaZ3DDMr6hwwoy3Jam04xeL6w/BqX7/O DJUJk28sJJ5H1/kx2uVOAtag/Ruf/LrG99XwTNiXW1SwcbAQuPf6nIt2GYS1QXQnRzy2 +n+v3aF5qmChBW2ySx/LMSQStSuMzv1gKi4EPrEA0OSJT9ZiaqnUXA3LbVHTNQ6q/K6X wCtg== 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=I4Qtgh2a4u3zXSG+qN7HdqIRer2E5RoYy/3sIwfX3PA=; b=K81/B3L1mCvwRN11zOEU6bOOgqIxw/ePKsIy6FpM37aXeAcG4OpV2TxXlzJLeuvpod A/keCq56JJmM1Zs9azZWMoitYG2Dd/2LV+925wkXX6Poze8s+12dugGNqjeO9vlcn7BQ 2BZL2d78/UOopBluLP+Sl/XGLrZRrcROCRWl9Co3gJ2zw8u0zORO5i+QnK7HvnV/QazF EuVq4hy2BRNXZwQAZRFPI1vasjkH17682cyzCG1DBRS0pa++rVXJAjXqhv97yvX6wIaN kXsrkHn3O4C/fT1EBZ2loWjqAr/Ak+4bAw2O9ytz+GoiMEwsMAjclSvrDxjqvD3hJdLk J8JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SkxoSreY; 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 o25si292518ejh.443.2021.05.12.09.30.49; Wed, 12 May 2021 09:31:14 -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=SkxoSreY; 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 S235557AbhELQ2T (ORCPT + 99 others); Wed, 12 May 2021 12:28:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:57088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233300AbhELPir (ORCPT ); Wed, 12 May 2021 11:38:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 52F8F61C6D; Wed, 12 May 2021 15:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832824; bh=qhp8UxIizMNAxqsyug1Q2e9MLRrjNztI+6JTKsnSaYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SkxoSreYscTmLmgWaSTlTR/365KzJzBvqlJpVMXw1QGUfzw8gQEeEaEcneW+tLKKX 4HzNTfdv4uk+nvCm7QpG5Ztii4iOlqsHJbZjAgWe5GYTMOtbLRjN+jpvL5+qBZHjE/ 60uNTOt+F8loECiE/ZdAHYEIgBDmrT6NeK927PmM= 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 5.10 437/530] i2c: emev2: add IRQ check Date: Wed, 12 May 2021 16:49:07 +0200 Message-Id: <20210512144834.133065112@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 bb6129c32867baa7988f7fd2066cf18ed662d240 ] 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: 5faf6e1f58b4 ("i2c: emev2: add driver") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-emev2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-emev2.c b/drivers/i2c/busses/i2c-emev2.c index a08554c1a570..bdff0e6345d9 100644 --- a/drivers/i2c/busses/i2c-emev2.c +++ b/drivers/i2c/busses/i2c-emev2.c @@ -395,7 +395,10 @@ static int em_i2c_probe(struct platform_device *pdev) em_i2c_reset(&priv->adap); - priv->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + goto err_clk; + priv->irq = ret; ret = devm_request_irq(&pdev->dev, priv->irq, em_i2c_irq_handler, 0, "em_i2c", priv); if (ret) -- 2.30.2