Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp588398pxj; Thu, 20 May 2021 17:07:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+lHSPJYCdpXsj48hyoKH4coB6+nWX7gOdEvDs1K0n2+eex4z4gegFnYhWUZa2kp+mbmWK X-Received: by 2002:a5e:c708:: with SMTP id f8mr3191715iop.198.1621555660135; Thu, 20 May 2021 17:07:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621555660; cv=none; d=google.com; s=arc-20160816; b=v4tUW+rOtpbA/Qx7aeuK/iCDBEPi2AAiHiy9wrbX2QsALER7wqA3EpgGqaeEfdgmJl SVFcOR+iq+8zjYncveS4M56b2k0Q+P8j7UWAKFXdruGyJa/yogWGvYzuGPuCZa2XZism YwOeQ0XUhVGo43ZHnEntiFySBlkFt43ndjjJPw1sIdiws2zoqbE3CeORV4W2RDKmik9U TSO1EJwOZE4ri53bYNAMugWjwYj+XaolKXZAv7VQyxnMZYAB8dF+kOsLq4hljMP7diAN in8lIw9hotAe1AJLx7Rm97PNOq3V7DfRISFzTdid32tvM6LBmBaLLXQcWMOwnsM2ORL8 9Q+w== 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=I7xXliHsWqkeUB94KieUVmmA/4+XYahJpcHukjizVvE=; b=tzMtnwnQ+AxHjw0bObAft1g9wD9PJpcCf2gTDTRZHfH6Nh9bcCMY0WBNZpTyPNL9O5 HuY/qJ18rP2Htgsq2pM1+g35CIAhPEF8o0X/GP5a1211juHc7mkJ5Mo3e5KBZjl2ZuGV Vly/+HOvwUyXWSFfeeHDXU3eBH/VS71qBwva/UwsC3yK8y67+ovstEopsxs/DMEwASiD 3MiSHm8iNHOVBtt2dkg/jUbFdyUNKh0EmcJTiB/rIvJkchFt6x7/a/nUCvYOYxBbfJoU xIXme4gVe0SK00s53NIRQ6U7Vc+sURHUbp+x00i49yxTujdPEDyF3M9a5jtsMXvqte87 IReQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zz8HuAZ0; 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 l126si5273999iof.101.2021.05.20.17.07.26; Thu, 20 May 2021 17:07:40 -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=zz8HuAZ0; 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 S240870AbhETLVX (ORCPT + 99 others); Thu, 20 May 2021 07:21:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:59406 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238805AbhETLBG (ORCPT ); Thu, 20 May 2021 07:01:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C5EA161D0B; Thu, 20 May 2021 10:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505016; bh=AjGOqExW+quzqlpRH62MIZZf6FTJQ3uW+MLWMVs9zNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zz8HuAZ09Y5QcQs1a/NkeUerLh8lv51k8mfydJZY2IeskbJlUv/nJQ5o1/PtrRAYV t6CSUQR3FymAfPxuIrWBVRqwc6VJh4iRHhZ2niindLvG7loScYD8PCpfDZpFlq0Kur IQD15KeqHFm6RERC2N91zdl+K+ckKlOBPAy2BbGE= 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.9 151/240] i2c: emev2: add IRQ check Date: Thu, 20 May 2021 11:22:23 +0200 Message-Id: <20210520092113.715678155@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@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 0218ba6eb26a..ad33c1e3a30f 100644 --- a/drivers/i2c/busses/i2c-emev2.c +++ b/drivers/i2c/busses/i2c-emev2.c @@ -398,7 +398,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