From patchwork Wed May 1 22:38:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijay Khemka X-Patchwork-Id: 10925629 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 F2CE815A6 for ; Wed, 1 May 2019 22:38:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7D7728AFD for ; Wed, 1 May 2019 22:38:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC49328EE3; Wed, 1 May 2019 22:38: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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 7723528AFD for ; Wed, 1 May 2019 22:38:48 +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:Date:Subject:To :From: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=yk9QhBUuDsV+f+sAqsyE7kILg5rH4rfSVN4HhzCk5pc=; b=S9kOVRMbC2pEzw Yw26TO5EK0TKo7ekocFmEpcO9wx2G56jNVNLP0nu27ft+N5ol8V801CmRLowVMoskfwiYBbomnxN5 TB3xmkRjYRIDdsHusHw2U+EXwNoWXVOXIV6KsTygWQ5Dq0DJikk2tR8+kaBAlbe0ymZEdiUy3paDS q87gK/m+7pq1g/5nORXikKAC6j1B/JbrZp7lJsNXCaG8qHAL2M/kf+GOJOEpZsGs5b8Nu62n6yMz1 M72WE4185iEQe1eWQ97AnKskm8OqTTpjfXjn01IkM9H14uTtBhtk+p2ND1p0MdvQbj7FK68f3tPRA ZXuLa8LvDxRxv5ZIJAzg==; 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 1hLxsC-0002p6-Lh; Wed, 01 May 2019 22:38:44 +0000 Received: from mx0b-00082601.pphosted.com ([67.231.153.30] helo=mx0a-00082601.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLxs9-0002oj-4U for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2019 22:38:42 +0000 Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.16.0.27/8.16.0.27) with SMTP id x41MYheA004397 for ; Wed, 1 May 2019 15:38:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=facebook; bh=iIazPrlt7tOWnA4QOJ1iZhFr3bvbXxhMyXLj+/1AyVo=; b=j8s/grND7dbtTkbGg4Oidn9G/lEmLB02oSc61IkhyEn3fGtswvwxqTDQrbR3yMYO++fH GKRJBJ8SlfhOrFRRYkZFht5+pf4oQOPYmsukdQOAxG3SW26cY5DXPhTBf76pX0bYx/3A 0JmjbboaRFUQr6QNa+Ecx4SUhq2FKPjo+cA= Received: from mail.thefacebook.com (mailout.thefacebook.com [199.201.64.23]) by m0089730.ppops.net with ESMTP id 2s7d0q1mhm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 01 May 2019 15:38:40 -0700 Received: from mx-out.facebook.com (2620:10d:c081:10::13) by mail.thefacebook.com (2620:10d:c081:35::126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5; Wed, 1 May 2019 15:38:38 -0700 Received: by devvm4117.prn2.facebook.com (Postfix, from userid 167582) id 8A7AAD5ED26F; Wed, 1 May 2019 15:38:38 -0700 (PDT) Smtp-Origin-Hostprefix: devvm From: Vijay Khemka Smtp-Origin-Hostname: devvm4117.prn2.facebook.com To: Arnd Bergmann , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , , , Smtp-Origin-Cluster: prn2c23 Subject: [PATCH] misc: aspeed-lpc-ctrl: Correct return values Date: Wed, 1 May 2019 15:38:36 -0700 Message-ID: <20190501223836.1670096-1-vijaykhemka@fb.com> X-Mailer: git-send-email 2.17.1 X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-01_10:, , signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190501_153841_297106_3A2F42C3 X-CRM114-Status: GOOD ( 14.02 ) 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: sdasari@fb.com, vijaykhemka@fb.com 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 Corrected some of return values with appropriate meanings. Signed-off-by: Vijay Khemka --- drivers/misc/aspeed-lpc-ctrl.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/misc/aspeed-lpc-ctrl.c b/drivers/misc/aspeed-lpc-ctrl.c index 332210e06e98..97ae341109d5 100644 --- a/drivers/misc/aspeed-lpc-ctrl.c +++ b/drivers/misc/aspeed-lpc-ctrl.c @@ -68,7 +68,6 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd, unsigned long param) { struct aspeed_lpc_ctrl *lpc_ctrl = file_aspeed_lpc_ctrl(file); - struct device *dev = file->private_data; void __user *p = (void __user *)param; struct aspeed_lpc_ctrl_mapping map; u32 addr; @@ -93,8 +92,8 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd, /* If memory-region is not described in device tree */ if (!lpc_ctrl->mem_size) { - dev_err(dev, "Didn't find reserved memory\n"); - return -EINVAL; + pr_err("aspeed_lpc_ctrl: ioctl: Didn't find reserved memory\n"); + return -ENXIO; } map.size = lpc_ctrl->mem_size; @@ -134,16 +133,16 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd, if (map.window_type == ASPEED_LPC_CTRL_WINDOW_FLASH) { if (!lpc_ctrl->pnor_size) { - dev_err(dev, "Didn't find host pnor flash\n"); - return -EINVAL; + pr_err("aspeed_lpc_ctrl: ioctl: Didn't find host pnor flash\n"); + return -ENXIO; } addr = lpc_ctrl->pnor_base; size = lpc_ctrl->pnor_size; } else if (map.window_type == ASPEED_LPC_CTRL_WINDOW_MEMORY) { /* If memory-region is not described in device tree */ if (!lpc_ctrl->mem_size) { - dev_err(dev, "Didn't find reserved memory\n"); - return -EINVAL; + pr_err("aspeed_lpc_ctrl: ioctl: Didn't find reserved memory\n"); + return -ENXIO; } addr = lpc_ctrl->mem_base; size = lpc_ctrl->mem_size; @@ -239,7 +238,7 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) of_node_put(node); if (rc) { dev_err(dev, "Couldn't address to resource for reserved memory\n"); - return -ENOMEM; + return -ENXIO; } lpc_ctrl->mem_size = resource_size(&resm);