From patchwork Mon Jun 2 21:25:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 4284011 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2F7F1BEEA7 for ; Mon, 2 Jun 2014 21:24:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5965A20259 for ; Mon, 2 Jun 2014 21:24:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8367A20260 for ; Mon, 2 Jun 2014 21:24:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040AbaFBVYk (ORCPT ); Mon, 2 Jun 2014 17:24:40 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:52792 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752756AbaFBVYj (ORCPT ); Mon, 2 Jun 2014 17:24:39 -0400 Received: by mail-wi0-f173.google.com with SMTP id bs8so5410873wib.6 for ; Mon, 02 Jun 2014 14:24:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2nOlqpXAhOD4KvDer8wXz7fXrFeuVYBB697K5G2qMXI=; b=XU97KMtDaVbeEI41SS1PO3LAKgtbGlGW4Eu2XWIDWXnAyfsQx24caNkv8WHMOta5Lr 3WXEWCexZ00Y5IX8Mxx6jdIzUtR//6iXUORVBRe3/Wza+hWC5/WUhUTAJ53Y/oDqvPkH R15GQU56VLturtIgBxp/NxOgIrQkLD9PKLwepFSw5sXyFmfz0fK6pjey8n9YjXfinxOa UzG0R/2ROmy9hKkz5lyKAnyt3PE5sY3N0g5onj4giekrGphq3mYkuGpDyUpWAfL4UAfR o61ShY+DpwEazWZWsvwtAX3oyJTBQjMHDXjnRj/671Aj4cEfUimG0/hmcyDHiYK5kr17 nmOQ== X-Gm-Message-State: ALoCoQmCd2hFoqyzYbR3rb8iA7iIuFpsnmGbS/Zfgdh6IJn+TjlfCsDAhv60PeQCB1tF6tOZjmEZ X-Received: by 10.180.187.111 with SMTP id fr15mr25680347wic.57.1401744278191; Mon, 02 Jun 2014 14:24:38 -0700 (PDT) Received: from localhost.localdomain (h-245-62.a218.priv.bahnhof.se. [85.24.245.62]) by mx.google.com with ESMTPSA id bn10sm35749696wib.7.2014.06.02.14.24.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jun 2014 14:24:37 -0700 (PDT) From: Rickard Strandqvist To: Eduardo Valentin , Zhang Rui Cc: Rickard Strandqvist , Grant Likely , Rob Herring , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH] thermal: ti-soc-thermal: ti-bandgap.c: Cleaning up wrong address is checked Date: Mon, 2 Jun 2014 23:25:30 +0200 Message-Id: <1401744330-25966-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Wrong address is checked after memory allocation. Signed-off-by: Rickard Strandqvist --- drivers/thermal/ti-soc-thermal/ti-bandgap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 3ab12ee..43c0f83 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c @@ -1155,7 +1155,7 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev) /* register shadow for context save and restore */ bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) * bgp->conf->sensor_count, GFP_KERNEL); - if (!bgp) { + if (!bgp->regval) { dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); return ERR_PTR(-ENOMEM); }