From patchwork Wed Sep 26 10:43:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10615709 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B8FA313A4 for ; Wed, 26 Sep 2018 10:43:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA5F22A64D for ; Wed, 26 Sep 2018 10:43:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E8D52A65B; Wed, 26 Sep 2018 10:43:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5216C2A64D for ; Wed, 26 Sep 2018 10:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727434AbeIZQ4H (ORCPT ); Wed, 26 Sep 2018 12:56:07 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:34922 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726841AbeIZQ4H (ORCPT ); Wed, 26 Sep 2018 12:56:07 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8QASMlE040459; Wed, 26 Sep 2018 10:43:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=9l7Js+gu6rJNOU5jhubC0vfIYSg/R3bAJZEz2o+a6Jc=; b=EsL8foAE1sbZBq725d67QbXkcdFTKAc33AoyNbYmqOo4lTIXWSA8By/JipyHPGD7Gcu8 fzH7X0kDQsetbeaTFjBvDfB68DRy8zcluUniHVjGloSaQTR0rcEx9FpNFuwjZiXpdJ+R QIdS0Xwr01MrNya58KHAV2Dlrx+qkIIL8mxCPTDH/CFouuOqeoDloUsnMrSlzCyUmqyX 2VewnVoNVU1Z0QpQh3s93LdMplpXUePSxkGN/gawR4MCvOycdeuE/FM5c85mGVPZRjN+ OeKZbcqm24xmVqfbwxVCUbrg0q+9ojTCnu+1evGrwC7g73fZ2kmYbrJtRMAsd8KQMMVJ RA== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2mnvturbgc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Sep 2018 10:43:40 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w8QAhYwY010721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 26 Sep 2018 10:43:34 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w8QAhY8B030328; Wed, 26 Sep 2018 10:43:34 GMT Received: from mwanda (/10.175.46.9) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Sep 2018 03:43:33 -0700 Date: Wed, 26 Sep 2018 13:43:36 +0300 From: Dan Carpenter To: Zhang Rui , Miquel Raynal Cc: Eduardo Valentin , Daniel Lezcano , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] thermal: armada: NULL vs IS_ERR() bug in probe Message-ID: <20180926104301.GD14535@mwanda> MIME-Version: 1.0 Content-Disposition: inline rom: Dan Carpenter X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9027 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809260105 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The platform_get_resource() function doesn't return error pointers, it returns NULL on error. Fixes: 3d4e51844a4e ("thermal: armada: convert driver to syscon register accesses") Signed-off-by: Dan Carpenter Reviewed-by: Miquel Raynal diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 2c2f6d93034e..ebfe7c9a5a7a 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -526,8 +526,8 @@ static int armada_thermal_probe_legacy(struct platform_device *pdev, /* First memory region points towards the status register */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (IS_ERR(res)) - return PTR_ERR(res); + if (!res) + return -ENODEV; /* * Edit the resource start address and length to map over all the