Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp632465pxj; Thu, 20 May 2021 18:28:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsQgxWZ69VIvve15/2JaLrPb0Xt7WszY8XGlzEUb5O4wvOvQkT9/ZU85jvOmC1vlBhwjdJ X-Received: by 2002:a02:938f:: with SMTP id z15mr495452jah.70.1621560537441; 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=AiebZGIwJVhuK4YfPO6q6Hp9e1fE2ipHJxEeHfR2O0m0majHimUfuFH7rFuYdU4tFV ysqJDIaThteuVED483rLk095fO1gn1ESEyS3aXjbFWph3cv0F4ohgwhqEEJ3x5sWqwaK FmOw9t/GtxfVVYNItcUKYJzicV7f1Z5qtdmjIegryyCGCLOxNouwFmltEJZlARcDlFeD Px6ciOQYf1ygFmTKKAprzXQDorlKzc32W/PrYGJYZKzcM/ftSZ1OBVNgtZIin/932i0s vk7w0LWg3we9KkaqWvl4CRk0iEr3mdB4z4/FkMS4qPhzD+24TwVNLUKlOM95aOBpFsDA RTJg== 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=XQN8iPKcgIVYzz95K/1apgqITaxmHuydy9BaV5Ow6+Y=; b=naBUeu9xH7v2Xnbw3ihbwwcEF/UU8h49wTgknqhK72MsFhsRxGg+7fWpG0nhMTgv8O H844JRb2pWeDZ5TeiVD2OpIJ84zRYqS6EsFJ8PcPemvB1jGPCvfgb/7Lstw5/jsGS/GW MWvJ8S8Ne9CtVY3j2h+79BHi2JarUDCluRZFUotihaAOCMQPnHGsf1Xm5DywKbQOL3v2 uPq8nr4bJPEk9ioT2RWzMnfdQ7Z36MAc2VRDhCQ0YReFBeINs1VVZiarR0kexA1uPPzD fn4y5U1cN8doOsQPvQML73zxr+VMpoV1P5l998Yx2iKK3xguvQImbPuDXSY+ioayFgTX oSSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="1B/gJ5UX"; 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 i20si3770916jal.25.2021.05.20.18.28.44; 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="1B/gJ5UX"; 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 S240665AbhETLio (ORCPT + 99 others); Thu, 20 May 2021 07:38:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:41738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240622AbhETLTB (ORCPT ); Thu, 20 May 2021 07:19:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6FEEC61D6E; Thu, 20 May 2021 10:10:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505410; bh=iZTZoo/H+Eb2+ejsX1PnEeku1dWxbnLOkC9Ru8jOEns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1B/gJ5UXgutpUAb/HVPDdrsO7JGLXDU8PfydCVHDLnCF+fc0iHhNQ3gp2ObnJq0aK bYRfgSn9yHVg2gU5B4hBl0zYx3dVoi5Tu39cygwvh3i/SR6Q/B8MgAILL/oWCoQadu PrwRazmd71Dyg2G4+A+dN6+hROvWVMcwjD4Ov+/k= 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 123/190] i2c: sh7760: add IRQ check Date: Thu, 20 May 2021 11:23:07 +0200 Message-Id: <20210520092106.268405422@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 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 24968384b401..70e4437060d5 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