Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11786278pjo; Thu, 2 Jan 2020 14:15:41 -0800 (PST) X-Google-Smtp-Source: APXvYqynY4X4a7/41TyhFt6+6MCrIT4t5VdGNRhhXKAo81yRTwgQEmmlEl0DVaRqX0/Id1DWl1F7 X-Received: by 2002:a05:6830:1042:: with SMTP id b2mr95056688otp.306.1578003341677; Thu, 02 Jan 2020 14:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003341; cv=none; d=google.com; s=arc-20160816; b=rzLoLshgY1eXWsGCEOVQMpkqzgbn5x4W9Bt5swVELpYJp/5thucMYBewO1jCHVnub7 2CnmOnPn6A4Up/t0X74VQcuhSc3R/GXH3hcCgis2Q/PlHcp1ewWk6RoTDiDgv+0Ff6s0 6ZsIjZspVhR2W7sRjaELcwAwWjf564OghSGCYq7r/2WFQ70b2z9TKwgyNOVRr4tMHoIR r9RgDTfny57v2JlE1do+dLhvOhJDZOL9v0G4tYE/JnLkFx3xKG5zuOsQHcG2A8jEdQFQ A8ltDzGWg7hSyh0YxmZ73at0NdVxoZYgJ6yya6DfsP8UzuY+cbKaiDvqmpZoRNxSEoYs sVTw== 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:dkim-signature; bh=5Fh8O13XDwmJG4oLnGgCm9oVf5XyyU6/d80RyUJlWw4=; b=aBwnDaR0A1GprEnhwOLZNN0yQjWLpXAMQkwmc0ajIFAxBj8tFu6k511RmWYc9ObMqo beAK+PCJMjuIj4Dz+fdrW2izOX6U/axSLiUHLS9kc/cKTyEAJ4FHhHK2A25Kt7dAKPZD 2G8riXreMouOcEmTLC7EI2p/v8QVPbZee1TUgSvncN12tB+iO1yp63CzlvhWfIBOXX9I AmVGSkVND+fd40oDn8vwBawD80SykurBb7el7xOG21wDSdipqSYDv9xLrgrRWN52sFZr +ia4T+zfDCO8JLu3fA+oImDxDl9RUxYxH8Shedzy8FvSDsjLsAmN08RIiFlCTJCYSjLx bKHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nd3JC7Am; 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 j16si30025596otq.23.2020.01.02.14.15.30; Thu, 02 Jan 2020 14:15:41 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Nd3JC7Am; 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 S1727307AbgABWNS (ORCPT + 99 others); Thu, 2 Jan 2020 17:13:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:52940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727658AbgABWNQ (ORCPT ); Thu, 2 Jan 2020 17:13:16 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1C689222C3; Thu, 2 Jan 2020 22:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003196; bh=xnW7rkeCq03lAambOoxHgnTlWg2IdNBcrPVgd6k9tpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nd3JC7AmTXUPxCeqAR0Owb8aNBrexe6ARLzV098C9lkjRcyhih6k6qBVTY68PZNvk BOeR4rfbVdgHoV4XeoFt/yBi9Ac5eitB+KmEIIxuhosfWviB9fjybBgZpf9JXx7w+3 hTld5J+JDrHWrh7ILnq49XFVxGg9bLkTy2049TnA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Pavel Machek , Sasha Levin Subject: [PATCH 5.4 034/191] leds: an30259a: add a check for devm_regmap_init_i2c Date: Thu, 2 Jan 2020 23:05:16 +0100 Message-Id: <20200102215833.636319117@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Chuhong Yuan [ Upstream commit fc7b5028f2627133c7c18734715a08829eab4d1f ] an30259a_probe misses a check for devm_regmap_init_i2c and may cause problems. Add a check and print errors like other leds drivers. Signed-off-by: Chuhong Yuan Signed-off-by: Pavel Machek Signed-off-by: Sasha Levin --- drivers/leds/leds-an30259a.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c index 250dc9d6f635..82350a28a564 100644 --- a/drivers/leds/leds-an30259a.c +++ b/drivers/leds/leds-an30259a.c @@ -305,6 +305,13 @@ static int an30259a_probe(struct i2c_client *client) chip->regmap = devm_regmap_init_i2c(client, &an30259a_regmap_config); + if (IS_ERR(chip->regmap)) { + err = PTR_ERR(chip->regmap); + dev_err(&client->dev, "Failed to allocate register map: %d\n", + err); + goto exit; + } + for (i = 0; i < chip->num_leds; i++) { struct led_init_data init_data = {}; -- 2.20.1