Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6879169ybc; Thu, 28 Nov 2019 07:03:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxeVqr7lZ2l7jKv/4Qrtf5BSbkXVXbltaYdl5pVgqUyIIFWyW9zrqdi2Zt0QLj/5q5nRIGh X-Received: by 2002:a05:6402:898:: with SMTP id e24mr711234edy.240.1574953418515; Thu, 28 Nov 2019 07:03:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574953418; cv=none; d=google.com; s=arc-20160816; b=WfScCI4ogugl20OgfxCSjUzlh5MN3a+xffgbhHWVVWUqp23cPIYK4yLv6Kp/taXLUF Erq3N6+XoUiKPqdrzm8/JcxzjeEKaRetaDymPZ8+C+8RLCeTarwhFb9ceToDAS4z7hx7 puJqE2r+ksByFHXXVwlwwxIUB7nKD0h7uek6wI6pC6JU8YwxZCslsv7VrZSquZsdwF/M Mb9nfsHXGGW8KLq8LZkUeQA5AHV5ex0ytgyFsF0A2ECKdBGNPerSUr9x4iU/oDAE8J5F an72nJBhIcAXTtbTYayMiIlE0LTUs7vGCXP4RQp5mq30x5UvnggEVTwySGHFT7zclH8n AeFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=izqhGk+7dYtc0qSDmqSrNzca5ES+nhNiwDVQCjT9+7A=; b=W7EhTLw12dFfGsmoMIF+i4N9WQvziaJ3LVOBZVo0IDXH9UjKZXjjudZxJxWLSxg1hc SN4IaZND7UZxAwhmSLP38M+bXBxLkB2n83+1lRs/AMBbW/qt2b3ul9h854vi1Q+d6Ppd YDxbHlHZOU4C7tbe+r0IkISUxo3HSZOaQWNWc9PMg7fIOPVlRXS/3OV8GeMWxXV+kec/ PR+lAK7XqN8SZIlDNdvVQ83kGpD/WuTFYV5+iBzAzMUZNwBbZl1ifTHeROKPruRyYOs6 VRRErg50pbtp5/IaGD2rjK7M3RkRqO2d9Psrbt6ngnGOmPkx1cHsJ8SKzbYDIkpG2d7K pf0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=V2jSMZBN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si12797582edr.217.2019.11.28.07.03.11; Thu, 28 Nov 2019 07:03:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=V2jSMZBN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727715AbfK1O66 (ORCPT + 99 others); Thu, 28 Nov 2019 09:58:58 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:46210 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727517AbfK1O55 (ORCPT ); Thu, 28 Nov 2019 09:57:57 -0500 Received: by mail-lf1-f68.google.com with SMTP id a17so20228838lfi.13 for ; Thu, 28 Nov 2019 06:57:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=izqhGk+7dYtc0qSDmqSrNzca5ES+nhNiwDVQCjT9+7A=; b=V2jSMZBN8uh/xpePhhzkN28hW1PU3ZPx3auFFgQEEIv24PnHG7WcUuT9Hr7TOse5Rk FIOhKMME0cB9iUKg1zBa4lJ8C9Vi0lSdcsXWunqNCSFJ9Nz0OrpeEQRglQhTBkE35R9e ejuls2cV8st5na9tOFkujKVk+QD9iuwF49KvM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=izqhGk+7dYtc0qSDmqSrNzca5ES+nhNiwDVQCjT9+7A=; b=lNByBew7xMeg/2Gt/y/1VewersdXJqe1u/4mv7N4uTfCOwbPUb1ua8PPY4VvBPxhzl Y6W9MioBhMhiGIUDk7HjTmAF13TpzCI7q1pcXm85PVSp2DomT/ic2ifibdn0Q6S0aOgu 2K0JUcsSDPcpJz/erm0F+8FBj1rzKdY/rBe/MgcF3p+8gwp9NHRjmJnfpulEj5UXbi+n aI2ia5MgS54yhD3eqBrFPwKADwPznE6jKGyVB0eEIWlsc3RiCxi49m2SX0YS656xcB1P V1dVD7QY2eUGF4cJW86kf9oZbjC+JUWb9CLZiHiqNSNoZmqv4AUyounRJeoo8ii2Ihot Nz9A== X-Gm-Message-State: APjAAAXHvvwfOWXXbHUjJG9ZC+e0PTJLBrZo9W0+/ELtp/9SmIWvfDpX Nntn+4dWcQSm06JOODL3LSUyKA== X-Received: by 2002:ac2:5a08:: with SMTP id q8mr32413398lfn.106.1574953074176; Thu, 28 Nov 2019 06:57:54 -0800 (PST) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id u2sm2456803lfl.18.2019.11.28.06.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Nov 2019 06:57:53 -0800 (PST) From: Rasmus Villemoes To: Qiang Zhao , Li Yang , Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Scott Wood , Timur Tabi , Rasmus Villemoes Subject: [PATCH v6 37/49] soc: fsl: qe: make cpm_muram_free() ignore a negative offset Date: Thu, 28 Nov 2019 15:55:42 +0100 Message-Id: <20191128145554.1297-38-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191128145554.1297-1-linux@rasmusvillemoes.dk> References: <20191128145554.1297-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This allows one to simplify callers since they can store a negative value as a sentinel to indicate "this was never allocated" (or store the -ENOMEM from an allocation failure) and then call cpm_muram_free() unconditionally. Reviewed-by: Timur Tabi Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 962835488f66..48c77bb92846 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/fsl/qe/qe_common.c @@ -176,6 +176,9 @@ void cpm_muram_free(s32 offset) int size; struct muram_block *tmp; + if (offset < 0) + return; + size = 0; spin_lock_irqsave(&cpm_muram_lock, flags); list_for_each_entry(tmp, &muram_block_list, head) { -- 2.23.0