Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp169112iob; Mon, 2 May 2022 16:09:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/xtrzi7wFa+kxZmkhRG/7FZVV1LpfxNyjyiCioCGsd7hljguPI4XOw1uKdL0HplyUeiWA X-Received: by 2002:a63:185f:0:b0:386:1838:8d0 with SMTP id 31-20020a63185f000000b00386183808d0mr11512791pgy.161.1651532985228; Mon, 02 May 2022 16:09:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651532985; cv=none; d=google.com; s=arc-20160816; b=MjFS/WHxebIqqrxZBHX8ltkczoPLDExuhXS8B4eiLuA9qcDAbPON9iPfgpSsImFvdK tVeOAV0o2J6VUiNpWHr1faLJK64zhWmQk8zJm+6LVl6Q7DEW1UITV8kR3e5nBRpv+qYH MUEwqHXvoEE2yiqZoiDIZ++0OUf6Unq4u7SEdGHoky3Rpq40VzkGV9g2OPDSmb7jrYCH v3SuQk2Rqq5xG2Z63Z9kUUOYC2E1nEL+SSpZadW9xuMW/qH2JknUxcsnh5A9u58TWCpo aXgG3j1HnMypGy66VTdbQ1wHKDhP/luh7RHTKCLrn0PKn1fX4aACHRWodjbYwDkhH9PW WQVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oljhvr5L//T9Vy02GcvXRkCXJypJDloAClOtYKsY/0E=; b=rFvZAwuNa3RcphL0lNkMCAR/5LvpQQodUmIV/SxT5vYPcp7NYwhU5hPHpi4Uw88By7 x9qfs/aP/Mz4RDC/QJpW5Uu5gXWjHJcqcXAuSXnE9/fE//7XIR5K9OrG46M910G+i160 kkjrJQOVoHFsvcWjdPyom8f9F+Yv8LmeGjj+DfK8b3diE3GaybSZW/jLTkPhFxXaXPJx aXxjWWFuy+lw9j9uHzmJEgr7geW9r6i21Kes750aHR31YtBcXZ8tRw6yQpmwHmabpALp RS/7RcV8+6spuTYLXQO+nnFAd0jvCI4BFxCJ+qN6J6qN+JlLYoBV+yCWMJ0wdkPL7wbK 1wnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m8g+klr4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m12-20020a170902db0c00b00153dd942e08si4273572plx.407.2022.05.02.16.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:09:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m8g+klr4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9DD8C2F393; Mon, 2 May 2022 16:09:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386829AbiEBSV2 (ORCPT + 99 others); Mon, 2 May 2022 14:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386789AbiEBSVY (ORCPT ); Mon, 2 May 2022 14:21:24 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96641F3F; Mon, 2 May 2022 11:17:54 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id z12so8376218ilp.8; Mon, 02 May 2022 11:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oljhvr5L//T9Vy02GcvXRkCXJypJDloAClOtYKsY/0E=; b=m8g+klr4FSoI2I5mvjR+ATb/3XQ5Mh5s9DwzGed58GsXWVUbF4mq3GH+lVjr5f5AhU 12UWNwsWDOb2Z85I9rHqYmC7DiU6MfAtWZSZFKKEorv7U9IWVh27fTnexF3l28nJ1Ug+ S9KqUcHmyh6hQPhhJeZ6XuV7LcBjwN8QlsiioG8w5lJTI+4zsWhhro/6dbWe7VtNa/rn XCvpgt3BwNQghGs+iV3DSWZgIN72E832AVZlcD+eVAWueyMwZUP6TwwFTIDXnazn6+wg dxLfzJNn0A+uRWTjF+e+nhEpFh3U+l5ANpQqY42f/ReFqR1XF0cLlTVvjfgE+lWzsJIn aFXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oljhvr5L//T9Vy02GcvXRkCXJypJDloAClOtYKsY/0E=; b=ztsXn1I8JCZwO6aL7Lwf6gyqgomRgFuU1ktFFvH103q8Gexy/pLQxUVZxMY6tMEg5Y GcifaNs58bSX/z25SRc9/4OLWC2fOKvrCWsMH7O0arDEqIgHTZwSOaMcjCc6lUT/5cSi vSy9davqeevioCRJAZ8bhp+YMawXNrpKIPyn6ADfGZG2V/DLbAZ3xi82IZDqyN/0DTO5 tSkWO8twFnuvWhOF6Nr+adZR+9A/dszlKCGy3yyXxTrxWTfyAXoEHFAI2eXrLJ2zI1Kr C26eUEdt+KQY/SZkW0CVDsUiZQuwNLRzw5v3ZhoPlwvL4kf+AlqMnamz43jkuqOLqRkn ONlA== X-Gm-Message-State: AOAM532NxHcnZo5eN9XmJ4padbDM2zhZkAhqiNEhGR6URNC3xBSbZLlx JoSNz9u5K941p0Yk/m33oYwZ21Vmgv0= X-Received: by 2002:a92:c26a:0:b0:2cd:9acf:c42d with SMTP id h10-20020a92c26a000000b002cd9acfc42dmr5153571ild.143.1651515474007; Mon, 02 May 2022 11:17:54 -0700 (PDT) Received: from xps8900.attlocal.net ([2600:1700:2442:6db0:2d25:3fcb:9ffb:5d5a]) by smtp.gmail.com with ESMTPSA id f43-20020a02242b000000b0032b3a7817a9sm3230678jaa.109.2022.05.02.11.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 11:17:53 -0700 (PDT) From: frowand.list@gmail.com To: Rob Herring , pantelis.antoniou@konsulko.com, Slawomir Stepien , Dan Carpenter Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Slawomir Stepien , Jan Kiszka , Geert Uytterhoeven Subject: [PATCH v2 1/3] of: overlay: add entry to of_overlay_action_name[] Date: Mon, 2 May 2022 13:17:40 -0500 Message-Id: <20220502181742.1402826-2-frowand.list@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220502181742.1402826-1-frowand.list@gmail.com> References: <20220502181742.1402826-1-frowand.list@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frank Rowand The values of enum of_overlay_notify_action are used to index into array of_overlay_action_name. Add an entry to of_overlay_action_name for the value recently added to of_overlay_notify_action. Array of_overlay_action_name[] is moved into include/linux/of.h adjacent to enum of_overlay_notify_action to make the connection between the two more obvious if either is modified in the future. The only use of of_overlay_action_name is for error reporting in overlay_notify(). All callers of overlay_notify() report the same error, but with fewer details. Remove the redundant error reports in the callers. Fixes: 067c098766c6 ("of: overlay: rework overlay apply and remove kfree()s") Reported-by: Dan Carpenter Signed-off-by: Frank Rowand --- Changes since version 1: - patch 1/1 v1 did not apply on Rob's dt/next branch, rebase on top of 5f756a2eaa44 of: overlay: do not break notify on NOTIFY_{OK|STOP} drivers/of/overlay.c | 27 +++++---------------------- include/linux/of.h | 13 +++++++++++++ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index bd522da7f76b..ae5ea5b1079b 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -152,13 +152,6 @@ int of_overlay_notifier_unregister(struct notifier_block *nb) } EXPORT_SYMBOL_GPL(of_overlay_notifier_unregister); -static char *of_overlay_action_name[] = { - "pre-apply", - "post-apply", - "pre-remove", - "post-remove", -}; - static int overlay_notify(struct overlay_changeset *ovcs, enum of_overlay_notify_action action) { @@ -178,7 +171,7 @@ static int overlay_notify(struct overlay_changeset *ovcs, if (notifier_to_errno(ret)) { ret = notifier_to_errno(ret); pr_err("overlay changeset %s notifier error %d, target: %pOF\n", - of_overlay_action_name[action], ret, nd.target); + of_overlay_action_name(action), ret, nd.target); return ret; } } @@ -925,10 +918,8 @@ static int of_overlay_apply(struct overlay_changeset *ovcs) goto out; ret = overlay_notify(ovcs, OF_OVERLAY_PRE_APPLY); - if (ret) { - pr_err("overlay changeset pre-apply notify error %d\n", ret); + if (ret) goto out; - } ret = build_changeset(ovcs); if (ret) @@ -951,12 +942,9 @@ static int of_overlay_apply(struct overlay_changeset *ovcs) /* notify failure is not fatal, continue */ ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_APPLY); - if (ret_tmp) { - pr_err("overlay changeset post-apply notify error %d\n", - ret_tmp); + if (ret_tmp) if (!ret) ret = ret_tmp; - } out: pr_debug("%s() err=%d\n", __func__, ret); @@ -1192,10 +1180,8 @@ int of_overlay_remove(int *ovcs_id) } ret = overlay_notify(ovcs, OF_OVERLAY_PRE_REMOVE); - if (ret) { - pr_err("overlay changeset pre-remove notify error %d\n", ret); + if (ret) goto err_unlock; - } ret_apply = 0; ret = __of_changeset_revert_entries(&ovcs->cset, &ret_apply); @@ -1218,12 +1204,9 @@ int of_overlay_remove(int *ovcs_id) * OF_OVERLAY_POST_REMOVE returns an error. */ ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE); - if (ret_tmp) { - pr_err("overlay changeset post-remove notify error %d\n", - ret_tmp); + if (ret_tmp) if (!ret) ret = ret_tmp; - } free_overlay_changeset(ovcs); diff --git a/include/linux/of.h b/include/linux/of.h index 17741eee0ca4..f0a5d6b10c5a 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1550,6 +1550,19 @@ enum of_overlay_notify_action { OF_OVERLAY_POST_REMOVE, }; +static inline char *of_overlay_action_name(enum of_overlay_notify_action action) +{ + static char *of_overlay_action_name[] = { + "init", + "pre-apply", + "post-apply", + "pre-remove", + "post-remove", + }; + + return of_overlay_action_name[action]; +} + struct of_overlay_notify_data { struct device_node *overlay; struct device_node *target; -- Frank Rowand