Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7405649ybp; Wed, 16 Oct 2019 08:11:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzb+ikdTJnurZYTacsIBmC6n3bIPJwFQN0OULt32/xmADaWTZAWfqbIdqBiPdmYsYt+R7nV X-Received: by 2002:a17:906:8317:: with SMTP id j23mr39619828ejx.314.1571238706195; Wed, 16 Oct 2019 08:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571238706; cv=none; d=google.com; s=arc-20160816; b=Xo9F+HkhzmkVc8DKoy0+XLqdPRfNIxeCrHkcJbXidBVymcX0C2u234DpHs3dHm8iOm E5s9lQODiby0mLdFv72f7M4B8yIBU7D7LKiPsbBdLsqojdkZcr3eb2DbGzdDigNReFp9 lZDZ/AA1U06FTfNU46g5vSwUOOJC2M8MjV+qEElq/Tq6zfaFzqw31zHM8YbTUmJuMvpg zTwoX0kTu/W2SCBme4yIyaRDno83yyk0dd/80HmSgy8FjO671+5kUMiQZD7kiml6ICx1 8odaCJ7Jd/CEi1uMZ5kN6MT5uBa8hpIs3mSfgmExhnI4W0zn6/1ynDdICznL2dBpZ74y IM2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=F55Wt5S26tfWJ9YDzUSzM52fARPw99KqXvjlrC+Fh3g=; b=gRpqjw7OSh4L4LF7u7qtgZsjaXTQ0emvFmoY9AY1xZD1Eo5An3KtfO6+t8621jSo3h nWNrzy5lciclBZLD7mrAgP8h8sSxg6wbC4hMMgmkAshX7a91qErLf42gaQiWc6MqFb7+ 7E0SKkz3esfa1I/F45z+2/4vMbka5vrZK2rJ08X0Imo5o6jXWP7qOE6I4YKa+nMcaVid bUANIx7rSR6ATFD0WAGeMWPa4Wb2XnABa9RcN0HblBkOu3orGFJvZrU5ybLcNN8bWvyM fSG/Ooa/2GaHJ6oquFVAQ+A6p5eLakOmh1SAq/pTBnTMUlyQCJNtxQQhQODz6fME9T/2 ux/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ebMtAJuQ; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si15434530eju.265.2019.10.16.08.11.22; Wed, 16 Oct 2019 08:11:46 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ebMtAJuQ; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389142AbfJPMGS (ORCPT + 99 others); Wed, 16 Oct 2019 08:06:18 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44025 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726845AbfJPMGS (ORCPT ); Wed, 16 Oct 2019 08:06:18 -0400 Received: by mail-pg1-f194.google.com with SMTP id i32so14165837pgl.10; Wed, 16 Oct 2019 05:06:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=F55Wt5S26tfWJ9YDzUSzM52fARPw99KqXvjlrC+Fh3g=; b=ebMtAJuQlngR44Vl7KMnrR+dFZ+Nrj0hqzA0pmoxrQ8fVwoy255CC5iS0TkYgBwldj 1m3eTLY6SrRNaEqZ7MkV9cv+dsAMAtEqRo1JYYHlcam860EhPfAKxCm4G2fEYaTFd2ld SLOM7PU99kY8AySQ+cDC5EILWMSetW3CPlzjMtxg6KBdRF4uAE1YTqzrjhaj/g/0LAOa b1FthkhUXBwClscDHg6Z+svRgzOjTJDTpTW+kJ7K8uBlMRAFCGc8wAQS8v9SZhVAFHKC j2/Yr9DE8gNtE6qOMdGyiqDKOIb9UaRa6r1hOpGl6kpjyvrxENJKCS3Fq4go6uxUWRAE f1aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=F55Wt5S26tfWJ9YDzUSzM52fARPw99KqXvjlrC+Fh3g=; b=b+JNIUQAgZ/QQmEJyZISYHJna7hwILUU2hRuMIj+FHF2J7kqYWd1q3r7SZb74V7afG 3Or4d//WIxlbec/rgF732aHlsHEzHPEcEpS6TnFh5G0v7MCLsfaxMC19Gh9kWLuHsA/i 8WxC7Sm0KnouWHEKRxYl6OguYJDAxcbHANBiIQhNLP0GaJiq5oYMYCLc3tThtwJX3wKX lhTrVuS4kbBposASpUGIUwBCllHGuhMmj5qNmMj5HVskVv4YnD7hHPYx8xGq/NOP9qUC asdc2K0t+pSRjfF8cBncmjRJpibFP55SEVXLLsC8P2Mmpdzr6lI8eNRh5Po13jgPxap9 f7Cg== X-Gm-Message-State: APjAAAWo2V/veEwTqMr9eqkM6bTMaz4AAiC7xO2ex+jzbZU+IF4pJJJY cVO+TjSIH+Sht31eg0lcMoDeAMYUYlE= X-Received: by 2002:a63:cc4a:: with SMTP id q10mr44514091pgi.221.1571227577442; Wed, 16 Oct 2019 05:06:17 -0700 (PDT) Received: from suzukaze.ipads-lab.se.sjtu.edu.cn ([89.31.126.54]) by smtp.gmail.com with ESMTPSA id j16sm2641670pje.6.2019.10.16.05.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 05:06:16 -0700 (PDT) From: Chuhong Yuan Cc: Jacek Anaszewski , Pavel Machek , Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, Chuhong Yuan Subject: [PATCH] leds: an30259a: add a check for devm_regmap_init_i2c Date: Wed, 16 Oct 2019 20:06:07 +0800 Message-Id: <20191016120607.32718-1-hslester96@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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..03ad068f29f7 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); + return err; + } + for (i = 0; i < chip->num_leds; i++) { struct led_init_data init_data = {}; -- 2.20.1