Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2515830imm; Mon, 24 Sep 2018 05:46:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Vu+Vt+PQ4KS7q1kNjWNQAJTEyjVJtJi/6+dsYqyROQbdOzuJBnnqXClOOvylwjogUG21X X-Received: by 2002:a63:66c3:: with SMTP id a186-v6mr9480517pgc.330.1537793215278; Mon, 24 Sep 2018 05:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793215; cv=none; d=google.com; s=arc-20160816; b=FQYsS1PUMZa5xD5D8W5hvZB8UUc0BdWxy+O/a7AE0/QaXzvF+AQBnKvxF18Tb24r0Y KceLgAxvm1i4eviIlXB08QU6VMuyXgx3OZQcDHmYrn/lOZO7/1SfciLImK18MaWgqa0L CUTSqTkSl+9lyt2K2TMCPHN4t3S3LbTErjvH8PKnYeY83uI4MwDkj+U+Fl6TimTsAAip aVuNWVcoPYZXVyi2VBxEILzg+AawqFrB+IuIZeC86eGCVBsLjkK8k1TFW//bJlzo1eKv GYdUvMHreqHlNhCnLx2mstG7F9RQymgdL5xowBKzNfBTKNRRCKThvAFzvFvQ6BPFJPhe oi7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=manZ6Z8uyvVltatWf5Hta1Da7s+uXhPJPNhVmyCbUjE=; b=dl7ow6BsQhNgPegrPtDF0YS57sxOiU7YEZDj5LlifpEzAMbWhKO8fmPCX5/M34hdrA AX9W4MdTra0cAGEmwF4r5ktOCf8YfNyijuI26j/52bhdQmQtIcNB3bVM+Txp+DJXxar8 q9mS6Ojc3WnDE57Wf8izxzBqVMahFoBKiYFngJIHx4HYeFVheTIKeDaPE5a9sYCv9Fsq bAzNAzT4bZSBnI4trnLiS9BjMCeZRN4dTeCb/RH7+XucTKlUQx5oaplqDCQR31xR5CTy kRXzZNVNoGHEtgfT99FzbsmVgdLKFP4eTE6eVZ5T2XaRZSXlf9VKNP4FWMPX2nKW/Iab BQlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3-v6si34567258plp.85.2018.09.24.05.46.40; Mon, 24 Sep 2018 05:46:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389368AbeIXSrr (ORCPT + 99 others); Mon, 24 Sep 2018 14:47:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59836 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730401AbeIXSrr (ORCPT ); Mon, 24 Sep 2018 14:47:47 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DBE5E109A; Mon, 24 Sep 2018 12:45:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhouyang Jia , Alexandre Belloni , Sasha Levin Subject: [PATCH 4.18 210/235] rtc: bq4802: add error handling for devm_ioremap Date: Mon, 24 Sep 2018 13:53:16 +0200 Message-Id: <20180924113124.821758723@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhouyang Jia [ Upstream commit 7874b919866ba91bac253fa219d3d4c82bb944df ] When devm_ioremap fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling devm_ioremap. Signed-off-by: Zhouyang Jia Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/rtc-bq4802.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/rtc/rtc-bq4802.c +++ b/drivers/rtc/rtc-bq4802.c @@ -162,6 +162,10 @@ static int bq4802_probe(struct platform_ } else if (p->r->flags & IORESOURCE_MEM) { p->regs = devm_ioremap(&pdev->dev, p->r->start, resource_size(p->r)); + if (!p->regs){ + err = -ENOMEM; + goto out; + } p->read = bq4802_read_mem; p->write = bq4802_write_mem; } else {