From patchwork Tue Dec 18 07:43:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 1890621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 4F5773FC64 for ; Tue, 18 Dec 2012 07:46:54 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TkrqL-0001Q9-Vs; Tue, 18 Dec 2012 07:44:02 +0000 Received: from mail-pa0-f45.google.com ([209.85.220.45]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TkrqI-0001Pq-IR for linux-arm-kernel@lists.infradead.org; Tue, 18 Dec 2012 07:43:59 +0000 Received: by mail-pa0-f45.google.com with SMTP id bg2so333165pad.4 for ; Mon, 17 Dec 2012 23:43:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:subject:from:to:cc:date:content-type:x-mailer :content-transfer-encoding:mime-version:x-gm-message-state; bh=nMZxkxOsd5ncV4j7rw/Cfawr92WqayJQ2DkmsCXNA/w=; b=GdwYNjEZ0u8yLAakJ8VWqVjidngQZI4k0GW/jLYKvYYerZ9VvOagQWHZsScSkCo+1H oDaTZCF4UUv26Gr6GXYix9wcrJdVFFz8VZRVIIsLta9+zH0V6OYUscvK6zpfk0RAsDzj i6sXc01CzyVrPBaXuVRipJTxNerOEMRhekA3J7Cng0FlnAHFeCqoIwk9/fo7dmpwqnH5 sLLjZiPrYHaGFsUMYHCVhbIdOqMpNvFiJVSYg2wYAXBKazuD9AoiqvCDhXPl57YVDen7 dE8SawIoI1dDB6zkT/B2Ry8xuGXa2vpCghXLUQHnyfpd2UUsM74hen43U8vp+pE50uil 7HUA== X-Received: by 10.68.235.2 with SMTP id ui2mr3749178pbc.163.1355816635704; Mon, 17 Dec 2012 23:43:55 -0800 (PST) Received: from [192.168.0.101] (218-173-175-100.dynamic.hinet.net. [218.173.175.100]) by mx.google.com with ESMTPS id qb3sm705129pbb.35.2012.12.17.23.43.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Dec 2012 23:43:54 -0800 (PST) Message-ID: <1355816625.32595.0.camel@phoenix> Subject: [PATCH] clk: max77686: Fix return value checking for devm_kzalloc From: Axel Lin To: Mike Turquette Date: Tue, 18 Dec 2012 15:43:45 +0800 X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQla2wu+6XrJgjlQrJUwyu8K3pV7fsac/uE/6dfzEpgHu0KTKAaWF6P/znWsg/4hTyH9sTZ8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121218_024358_825924_F9249196 X-CRM114-Status: GOOD ( 10.12 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.45 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jonghwa Lee , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org devm_kzalloc returns NULL on failure. Signed-off-by: Axel Lin --- drivers/clk/clk-max77686.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-max77686.c b/drivers/clk/clk-max77686.c index d098f72..8944214 100644 --- a/drivers/clk/clk-max77686.c +++ b/drivers/clk/clk-max77686.c @@ -132,7 +132,7 @@ static int max77686_clk_register(struct device *dev, max77686->lookup = devm_kzalloc(dev, sizeof(struct clk_lookup), GFP_KERNEL); - if (IS_ERR(max77686->lookup)) + if (!max77686->lookup) return -ENOMEM; max77686->lookup->con_id = hw->init->name; @@ -151,13 +151,13 @@ static int max77686_clk_probe(struct platform_device *pdev) max77686_clks = devm_kzalloc(&pdev->dev, sizeof(struct max77686_clk *) * MAX77686_CLKS_NUM, GFP_KERNEL); - if (IS_ERR(max77686_clks)) + if (!max77686_clks) return -ENOMEM; for (i = 0; i < MAX77686_CLKS_NUM; i++) { max77686_clks[i] = devm_kzalloc(&pdev->dev, sizeof(struct max77686_clk), GFP_KERNEL); - if (IS_ERR(max77686_clks[i])) + if (!max77686_clks[i]) return -ENOMEM; }