From patchwork Tue Feb 6 12:45: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: 10202905 X-Patchwork-Delegate: dvhart@infradead.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 770AE60327 for ; Tue, 6 Feb 2018 12:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F49828A9D for ; Tue, 6 Feb 2018 12:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51F5428B06; Tue, 6 Feb 2018 12:46:12 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 D25BB28A9D for ; Tue, 6 Feb 2018 12:46:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752597AbeBFMqL (ORCPT ); Tue, 6 Feb 2018 07:46:11 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:58722 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752403AbeBFMqK (ORCPT ); Tue, 6 Feb 2018 07:46:10 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w16CgAsF189430; Tue, 6 Feb 2018 12:45:46 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-2017-10-26; bh=bhE8N4yix9A4Gex+FGPTpvRcxFZNOxwq8VGxx28OKvw=; b=ltCCrM//P2iT4/JmwPdoKMwx+G2ip9FQ6wJeDl9p8ZWaC1x0c47OeJSYc2yWquNP6+7s 64ShFEAXbwNuxF66LvLkOvfrlbeEmibKuPCmOWxGOIvDSm3kMN4KgwgI3xLu28IO9fkg a5yYNXu+lbSl7BghoOXfAnULXDVmOATOMu9Tu616Kf4kaHoQjmx8Kjp/opL+JoIeIZSj M2374eXXkHEaUiBzmrHzvW6qmNFFLGe+1IBNJ/228J/lgQP9SprEKb67qoaxhp3y8pIS MywCuQe7dWDFVx5J2oNnh8BgiGe5V4dNHgssvIfTBmZ1K0okYtc8AJ2+FQchfk7kkaLI sQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2fyck8010h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Feb 2018 12:45:46 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w16CjkvF013250 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Feb 2018 12:45:46 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w16CjioI032212; Tue, 6 Feb 2018 12:45:45 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 06 Feb 2018 04:45:44 -0800 Date: Tue, 6 Feb 2018 15:45:36 +0300 From: Dan Carpenter To: Vadim Pasternak Cc: Darren Hart , Andy Shevchenko , platform-driver-x86@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] platform/x86: mlx-platform: Fix an ERR_PTR vs NULL issue Message-ID: <20180206124536.GA9445@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.3 (2018-01-21) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8796 signatures=668662 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=821 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802060160 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP devm_ioport_map() returns NULL on error but we accidentally check for error pointers instead. Fixes: c6acad68eb2d ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface") Signed-off-by: Dan Carpenter Acked-by: Vadim Pasternak diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c index dfecba4407ac..27de29961f5e 100644 --- a/drivers/platform/x86/mlx-platform.c +++ b/drivers/platform/x86/mlx-platform.c @@ -522,8 +522,8 @@ static int __init mlxplat_init(void) mlxplat_mlxcpld_regmap_ctx.base = devm_ioport_map(&mlxplat_dev->dev, mlxplat_lpc_resources[1].start, 1); - if (IS_ERR(mlxplat_mlxcpld_regmap_ctx.base)) { - err = PTR_ERR(mlxplat_mlxcpld_regmap_ctx.base); + if (!mlxplat_mlxcpld_regmap_ctx.base) { + err = -ENOMEM; goto fail_platform_mux_register; }