Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2119042lkv; Thu, 20 May 2021 03:51:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9g27DGCsqsxRWKUwaxIn3tfPOvVl/5Ln2DOw4kdq94dD3hquts/O8VBrEWjQ9awjuuLRQ X-Received: by 2002:a17:906:4a81:: with SMTP id x1mr3968974eju.508.1621507918210; Thu, 20 May 2021 03:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507918; cv=none; d=google.com; s=arc-20160816; b=ep1bocLJ7qJ8ZMxnWisaskIaosqmh7MXYBpfP3UN/GRKVawcJwEUTHM7SY5gFnk2o0 bIOEh3lkYuNZKBuRf6Hjiuqh4IJXtT704KUCxrhByG4OQPCXQqERhFN+dkvz9hYE7UDw D5T1MlTC6WkLDlCQrRHOwg66YEwwGNDwm6XkAiCrL97xXgthAKAzFm7qGhO/8vECHkcy WLQfu5NIHYR2NxOgmVBVoz9jhnLt+rgw5yG7qD5kRvuXELQF2taAH52e6Sukvav41pDa MKuAKM9+q+9gX3ZfsSJxPGStRLu0HltB85yedt1mgefAR9ce8Y5O7haLfVWwHBw0Iya1 4Y8Q== 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=9kSqDDLmpE8uB2Nz18Xjt5vTSSki53/KUQKIbmiLd6o=; b=vY+gTFYM3Rj54+evPPT3Fd8DvqKj3CNbNH99Q/JIzbL2oxG2yDz+hrVKsIBzHOzezI nu1yawCQCZhCCioyuTTZJOhhBtB7ZNwGQq82agUJBGPkDpxnv2OEP+9iAU0Pa4W7uTeH 2DZLUi3YBEX1LDoleZbYIMkWLnGk9jNDCX/yiFuxp7DfFSQoNRj5l1X0EavUJRSDbjxp E1eXU6E004aqEdc1WMU1mJbPZbrImzRPK0yMqiAbrK98dTPjR4ALJKPt8UjMbjv6oOw0 R+yJzJotajKD48tqu6rSmsd+0PiIiWrh18I+CfozOt7uIjLfMn/174TKin0V3QlviMH7 UJ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N5vuu0ZL; 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 y16si2056369edc.193.2021.05.20.03.50.49; Thu, 20 May 2021 03:51:58 -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=N5vuu0ZL; 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 S237703AbhETKsu (ORCPT + 99 others); Thu, 20 May 2021 06:48:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:60378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236947AbhETKd3 (ORCPT ); Thu, 20 May 2021 06:33:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B467E61606; Thu, 20 May 2021 09:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504367; bh=os3IdbjtmowGQlAp1NLTz3BkNBLLRVYjWB6eNY2ukH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5vuu0ZLEU4VCbJ9JdvYvgbFYNeTQAKAa+mY0pqOoOIu2rJ5VEwALr6/JEubsyq1o z1MZOZBhdQeg4ybidxufwnRvpXbmVtcn/RWsP1TDcBsgag6QWj5Ma8ETCHRIGLNPzR iWdWgjb5El6M/r00sGmVNG7s1vt2uFf4dcZzy/KA= 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.14 214/323] i2c: sh7760: add IRQ check Date: Thu, 20 May 2021 11:21:46 +0200 Message-Id: <20210520092127.466115212@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 e5b2e3e742015dd2aa6bc7bcef2cb59b2de1221c ] 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: a26c20b1fa6d ("i2c: Renesas SH7760 I2C master driver") Signed-off-by: Sergey Shtylyov Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-sh7760.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c index c2005c789d2b..c79c9f542c5a 100644 --- a/drivers/i2c/busses/i2c-sh7760.c +++ b/drivers/i2c/busses/i2c-sh7760.c @@ -471,7 +471,10 @@ static int sh7760_i2c_probe(struct platform_device *pdev) goto out2; } - id->irq = platform_get_irq(pdev, 0); + ret = platform_get_irq(pdev, 0); + if (ret < 0) + return ret; + id->irq = ret; id->adap.nr = pdev->id; id->adap.algo = &sh7760_i2c_algo; -- 2.30.2