From patchwork Sat May 19 06:37:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10412557 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 E128360353 for ; Sat, 19 May 2018 06:37:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B652928521 for ; Sat, 19 May 2018 06:37:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 957F128526; Sat, 19 May 2018 06:37:53 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A74E28521 for ; Sat, 19 May 2018 06:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=cH5V/2jw78jEuj6Wv9MCeAGvlYSKaGqbg5ipnbyl94I=; b=Jb2LbW4U9Z8vql +JqFUwXKxCKrR+Lq7F11lBzjwt2R0yDAB/QNEMN2d9QUK9e5Vjy1DDRXr9lokRLeM7CYHY18uPn3W BddTSfMiNKbURWSII4AMwlYbUVD6+sXNJudzGN8eIJMdxi8qHmeRWkqJ2tDEeD1M2yr+QnlE9Xo3Y LvZEIQxdOjqrMeZlz1jfGotSv/BsA+kZ2OHg0BlKD1swuNHLZihAwQ0l05IvcD7dRjcvtCen6s+wQ VdX3d5eGCO0nRRGp538I8nGvFC6ayIVfeWh4K0no0lPTOqSxst4dI13Oy494QNt/qDRIOcSRcCNN9 sCsVmeoV2XrvTtHFINhA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJvUv-0004Tt-JU; Sat, 19 May 2018 06:37:45 +0000 Received: from userp2130.oracle.com ([156.151.31.86]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJvUs-0004St-Ow for linux-arm-kernel@lists.infradead.org; Sat, 19 May 2018 06:37:44 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4J6WpDd150820; Sat, 19 May 2018 06:37:22 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=PSnzyn6P9610XBe9vncNSsv4jBo8gnDzXtNsPZi6u/I=; b=ET7zG3Z7YppZPuNu6Pa3RjckypkJUdrIgJ7+jiqcDabGmc6p2FUozhQDSoeaZdATOwZf KkpU0zhP1wYRrpBt/kb5a7H+5KbwR28xIfwyHEVY800As1UyZ+O2H3Wtn9rkOofscMR+ Oph2aUiV/FD/uxrLGLocSjVT3ovYP1cKx5hDjmpXAYt1TJhdTE2iJfmxGUDrq+Y9+L/j v4Y15rEEGNArj9+jh8CiAJ2J8lPGpTQzw7B6b6uUtXGuiu54pGgk46mW1CdUZv2HrIEd WONdngDQt9hbR3sfdRTPgOWDT/k8v9/h9Oszvs/4e1otZL+JX8HNHxkylQNWnsz5ejxG qQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2j2bcd85re-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 19 May 2018 06:37:22 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4J6bMMD008117 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 19 May 2018 06:37:22 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4J6bLQa031854; Sat, 19 May 2018 06:37:21 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 18 May 2018 23:37:21 -0700 Date: Sat, 19 May 2018 09:37:15 +0300 From: Dan Carpenter To: Sudeep Holla Subject: [PATCH] firmware: arm_scmi: remove some unnecessary checks Message-ID: <20180519063715.GB4991@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8897 signatures=668699 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-1711220000 definitions=main-1805190050 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180518_233742_899109_BF9BA9BD X-CRM114-Status: GOOD ( 15.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The "pi->dom_info" buffer is allocated in init() and it can't be NULL here. These tests are sort of weird as well because if "pi->dom_info" was NULL but "domain" was non-zero then it would lead to an Oops. Signed-off-by: Dan Carpenter diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 2a219b1261b1..721e6c57beae 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -363,8 +363,6 @@ static int scmi_dvfs_device_opps_add(const struct scmi_handle *handle, return domain; dom = pi->dom_info + domain; - if (!dom) - return -EIO; for (opp = dom->opp, idx = 0; idx < dom->opp_count; idx++, opp++) { freq = opp->perf * dom->mult_factor; @@ -394,9 +392,6 @@ static int scmi_dvfs_transition_latency_get(const struct scmi_handle *handle, return domain; dom = pi->dom_info + domain; - if (!dom) - return -EIO; - /* uS to nS */ return dom->opp[dom->opp_count - 1].trans_latency_us * 1000; }