Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7431468ybp; Wed, 16 Oct 2019 08:33:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuSINDUyGUCu+jW6CJr/TpPDARE9n5ByATUwpUXvufvX19yBUkcu398a14XaC3GPLxOUl9 X-Received: by 2002:a17:906:7097:: with SMTP id b23mr41128174ejk.252.1571239996206; Wed, 16 Oct 2019 08:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571239996; cv=none; d=google.com; s=arc-20160816; b=GkY53f+sSIaJljOF3wUy0yMZw5Y5rNgLrIfukt+FFyChD6/ewFlIlzuCTtjK9ou0lO JGgiKhL87H7ZLCOjJtc3nom1ktARxlaBoWvz97jnV0UBqR3SC/2xMlm8GXvbzba+/shE eEAdkBwmXHAZ8Wa5ddHAQmvSgnzjtYD7m5fcKLCFgchlu2q3+VBfTrdIOTgGQcxFm0eB NIr2LBnI2bsWHRyXgVqJJVPE8M/PBou5qEyvIMbwYeWai1G/AEj84XEY4YXueGZWrKGM pcLL/2UqSsCWbfPoAAzASS3Ecs1NupxT0/b6I4vnMpFeDR9z6KTkAbpo1cBtSZDNAguB qKsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=1yO6MQItQdQePmVKkocVm+uu1v/nZ2c3sXLBJEhh1Tc=; b=kAGNRRdsdvAmDSRUz+RU9eG7/60Zuoqv/QzguYc/Xdjop1+4s/mlONTSFvTsb58fEq ghhp0cJPQvtgY9Irkwkb1ZtJXbwFZpGLawjWqj+ws5wQfcyroijXSrWqvpe/BuR7o2uC QjLZVqOf2rDQ/O7Pf9x93HmvH6iK1Axfr49lgC/DTZOWd8sY9YiJC+8Ih71T9/mn2xL5 WGo7erZBmslW4OXPGLaMDem3YjUQ4Rf0tGiwuv0TEfuOuzFwyqjzUwc7HbHTENA1vihY SgNK/+f44knNs/CN6f6xv2doG81A+3cor6xUVq4zWgRHbVi9+rwX03EN8WWTo/yf7VN7 EONw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="m/1f/KuW"; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h20si16707745edb.218.2019.10.16.08.32.53; Wed, 16 Oct 2019 08:33:16 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="m/1f/KuW"; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732564AbfJPMaM (ORCPT + 99 others); Wed, 16 Oct 2019 08:30:12 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:42956 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbfJPMaM (ORCPT ); Wed, 16 Oct 2019 08:30:12 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9GCU8Te063884; Wed, 16 Oct 2019 07:30:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571229008; bh=1yO6MQItQdQePmVKkocVm+uu1v/nZ2c3sXLBJEhh1Tc=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=m/1f/KuWPJB174uUX5awUVxS+l9harq2hrJisKcUnn4m287naYNWiS5e/ABHbUrvM E/0caQ7RL+//PzbwVwwNIR+lRRSzhx4IZX9grb+b18TxRCf0faFdDMkq8iYLPaC2fy YLu8Twy8OgZcV5GcGadixwY/TZBE5r7euqSOdoBU= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9GCU8Dt061831 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 16 Oct 2019 07:30:08 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 16 Oct 2019 07:30:08 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 16 Oct 2019 07:30:08 -0500 Received: from [10.250.65.13] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9GCU7Bl052311; Wed, 16 Oct 2019 07:30:07 -0500 Subject: Re: [PATCH] leds: an30259a: add a check for devm_regmap_init_i2c To: Chuhong Yuan CC: Jacek Anaszewski , Pavel Machek , , References: <20191016120607.32718-1-hslester96@gmail.com> From: Dan Murphy Message-ID: <89fb4769-d941-38d3-5536-fe4e750845b7@ti.com> Date: Wed, 16 Oct 2019 07:29:37 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191016120607.32718-1-hslester96@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Chuhong On 10/16/19 7:06 AM, Chuhong Yuan wrote: > 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; This should goto exit as the mutex is created before this allocation on ln 302 Dan