Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4627150pxj; Wed, 12 May 2021 09:32:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQaCso6/LzOzecQtvh8VvqX3RUcCX44pqsYoq+h7G2c7JuVEe4IikIZnszyB/PM+nt1YqN X-Received: by 2002:a2e:2a86:: with SMTP id q128mr29956716ljq.499.1620837144641; Wed, 12 May 2021 09:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837144; cv=none; d=google.com; s=arc-20160816; b=rvuLBB9f7JT9BLy5/6xQN3axBsiUfnqXc/lClFlKstjdqiu+3FEzUl+lz8MPyNGLAQ HRUWS/9lmeZUpSXm5vsfopF621eFYhYrg70CWS9JlWTXO+voKEIgCnMQLtlVZkCbhq9E 9k0+rwO1pXmzFVvznjvCiR/VDZqm+4nedmQp4d34Egh1jzZmJn5tb3LVz/jRMQauX+0j GHwuCCSGJKjmLqWp95hCDt006RMDzk7X3l3/MXpKTnIHzyRiqjAwQhoqaGkfbR1EQZju ayMpz4stFnjo+sSPRTWyhXSjP3xfehK7RKnrzxre2POFedFG6lXwx4qeEmjlGXm4htkT 2OBg== 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=6qvTFFr7cRBlrlrBDxYlMQ60gmfafW7Ykk9WSG0ABRg=; b=DeGGrU36iwJBbpmWgDmO3O9TjoDfCT9QWc5fbDVD3xKSkeLD764Pd8+aCyN8LGLeoQ Fjv1vPWi3TnnlzekU7ExKGaEOFmJTkvvJb+NXcbTbtfJErF6zyi9MZeIb56edIkr8o6z k6Jh6ZHJRmt3lEHlRQmdQL9vs6tfQz/46biPkTMK+evvts5gAscyuhZmYrl7Zcr602+t mQwAnxS6c54kg+zizDproHRPuJcB4l7wOSVoK8vIPOhM5BaVWZn0ubR+0mi9IQmMXwid MW9zTrc7gUWA0LJSh4Mp4H7JkSJMX1ili5TizhQQC5g9Sb6wipw6p5ItYEvIOleHyJlu DsMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zSeGW0lm; 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 k28si430347lfm.51.2021.05.12.09.31.52; Wed, 12 May 2021 09:32:24 -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=zSeGW0lm; 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 S236362AbhELQ3A (ORCPT + 99 others); Wed, 12 May 2021 12:29:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:55348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231859AbhELPi5 (ORCPT ); Wed, 12 May 2021 11:38:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 324AB61C6F; Wed, 12 May 2021 15:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832829; bh=79vaprTFR/PzptlH6sudeyUml2L5WIkbLadWPXgQaec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zSeGW0lmEpPEAuEdmW13481QpfgKvIXpw93/MlJqXssHjRXTO0hPY2UKpYXSYTl1w TtJcA7zg4F8HclbXLF1GnqWE/BUi8Ag2GbcHliVmORWi+qMBzf0g6lBzzrxqIyS6ts qgFfudhHKlc1bodRR3vg5FPKMzCPRZnoAHFWrgng= 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 439/530] i2c: mlxbf: add IRQ check Date: Wed, 12 May 2021 16:49:09 +0200 Message-Id: <20210512144834.201242070@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 0d3bf53e897dce943b98d975bbde77156af6cd81 ] 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: b5b5b32081cd ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-mlxbf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index 2fb0532d8a16..ab261d762dea 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -2376,6 +2376,8 @@ static int mlxbf_i2c_probe(struct platform_device *pdev) mlxbf_i2c_init_slave(pdev, priv); irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; ret = devm_request_irq(dev, irq, mlxbf_smbus_irq, IRQF_ONESHOT | IRQF_SHARED | IRQF_PROBE_SHARED, dev_name(dev), priv); -- 2.30.2