From patchwork Wed Jun 8 12:03:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12873362 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C1A6C433EF for ; Wed, 8 Jun 2022 12:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238585AbiFHMEB (ORCPT ); Wed, 8 Jun 2022 08:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238533AbiFHMD6 (ORCPT ); Wed, 8 Jun 2022 08:03:58 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D41A12296A; Wed, 8 Jun 2022 05:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654689838; x=1686225838; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A/KTS84ZoHA+r17AcI19edhkFKnIut364sqGDUAJQkA=; b=nrBRUiUwuH78ItTU3N8cwiTb2kQOcLHQ3DgUyvNgvSIZCRQqLKBpiHrh YB23FvxvMGZgrnOBM7Qq9UhuDqZqAkjMcyoydNweJ6gjhbfs2uu9opYdY Ms2VifbfqkkHsw8lIEXca26zJb8Br1Bevkb/mqAPbHMaMA1SW/Jm90nmg yeYlGPpB0oSMVaAq0N2scMOw0ytqdKuCPJoORKog7t7OMwVrPO30MSiHy mxEMTjw7ynpsCaokrAHkMWm3+FTAYx+sePhTYAXW4rDwoO4g3zKAfnWVp Lh50x9VFfTyxdp5wog4nHnqG8BxdaHZ7RvtZJI3/SYxPEbnMrKOuMde+u Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="256701611" X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="256701611" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 05:03:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="636792040" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 08 Jun 2022 05:03:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B1FE51D0; Wed, 8 Jun 2022 15:03:59 +0300 (EEST) From: Andy Shevchenko To: Jonathan Lemon , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Cochran , Andy Shevchenko Subject: [PATCH net-next v1 1/5] ptp_ocp: use dev_err_probe() Date: Wed, 8 Jun 2022 15:03:54 +0300 Message-Id: <20220608120358.81147-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> References: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Simplify the error path in ->probe() and unify message format a bit by using dev_err_probe(). Signed-off-by: Andy Shevchenko Acked-by: Vadim Fedorenko --- drivers/ptp/ptp_ocp.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 4519ef42b458..17930762fde9 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -3722,14 +3722,12 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) int err; devlink = devlink_alloc(&ptp_ocp_devlink_ops, sizeof(*bp), &pdev->dev); - if (!devlink) { - dev_err(&pdev->dev, "devlink_alloc failed\n"); - return -ENOMEM; - } + if (!devlink) + return dev_err_probe(&pdev->dev, -ENOMEM, "devlink_alloc failed\n"); err = pci_enable_device(pdev); if (err) { - dev_err(&pdev->dev, "pci_enable_device\n"); + dev_err_probe(&pdev->dev, err, "pci_enable_device\n"); goto out_free; } @@ -3745,7 +3743,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) */ err = pci_alloc_irq_vectors(pdev, 1, 17, PCI_IRQ_MSI | PCI_IRQ_MSIX); if (err < 0) { - dev_err(&pdev->dev, "alloc_irq_vectors err: %d\n", err); + dev_err_probe(&pdev->dev, err, "alloc_irq_vectors\n"); goto out; } bp->n_irqs = err; @@ -3757,8 +3755,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) bp->ptp = ptp_clock_register(&bp->ptp_info, &pdev->dev); if (IS_ERR(bp->ptp)) { - err = PTR_ERR(bp->ptp); - dev_err(&pdev->dev, "ptp_clock_register: %d\n", err); + err = dev_err_probe(&pdev->dev, PTR_ERR(bp->ptp), "ptp_clock_register\n"); bp->ptp = NULL; goto out; } From patchwork Wed Jun 8 12:03:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12873363 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F3F7C433EF for ; Wed, 8 Jun 2022 12:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238602AbiFHMEE (ORCPT ); Wed, 8 Jun 2022 08:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238541AbiFHMD7 (ORCPT ); Wed, 8 Jun 2022 08:03:59 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F069232A54; Wed, 8 Jun 2022 05:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654689838; x=1686225838; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q1sMptKRWmaXA4p2CjVpRnL0Jw2fDyzc4hN56hJsYXo=; b=S1B2CwuXUVBqThm8xUjUd+9AarMmGGyE1Aae/XUQ9L6o6rZm5hkd7GIt ObnS1nEEFehbkQGbuB6Uo0chFUog+GJHPxBDWmsT3MEkh1MHX0M8b/jXT Ee16iejsiNgJVApPayMUhiRhDFYB08yu5DgIw7JRe0niZIFvxFX25CmQ6 M41ZoGXtCYIOFE0tV3MM3f0G9w7OJxWZ482Te7ZnlBZfWHAJFJ/n4fFS9 m7BPjXiRTUm5jbFq7/zqz/qkXLPEhHGiCyKbtHmcvnel5tgHJApNbMyTE ZzLmTvPhE3LE9FmAJJEX3Gxl4ak1Ucq9z1yKqu67yJ/Gwcgt5cM9xlSNZ g==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="257302986" X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="257302986" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 05:03:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="615357877" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 08 Jun 2022 05:03:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B74D0343; Wed, 8 Jun 2022 15:03:59 +0300 (EEST) From: Andy Shevchenko To: Jonathan Lemon , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Cochran , Andy Shevchenko Subject: [PATCH v1 net-next 2/5] ptp_ocp: use bits.h macros for all masks Date: Wed, 8 Jun 2022 15:03:55 +0300 Message-Id: <20220608120358.81147-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> References: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently we are using BIT(), but GENMASK(). Make use of the latter one as well (far less error-prone, far more concise). Signed-off-by: Andy Shevchenko Acked-by: Vadim Fedorenko --- drivers/ptp/ptp_ocp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 17930762fde9..926add7be9a2 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2020 Facebook */ +#include #include #include #include @@ -88,10 +89,10 @@ struct tod_reg { #define TOD_CTRL_DISABLE_FMT_A BIT(17) #define TOD_CTRL_DISABLE_FMT_B BIT(16) #define TOD_CTRL_ENABLE BIT(0) -#define TOD_CTRL_GNSS_MASK ((1U << 4) - 1) +#define TOD_CTRL_GNSS_MASK GENMASK(3, 0) #define TOD_CTRL_GNSS_SHIFT 24 -#define TOD_STATUS_UTC_MASK 0xff +#define TOD_STATUS_UTC_MASK GENMASK(7, 0) #define TOD_STATUS_UTC_VALID BIT(8) #define TOD_STATUS_LEAP_ANNOUNCE BIT(12) #define TOD_STATUS_LEAP_VALID BIT(16) @@ -205,7 +206,7 @@ struct frequency_reg { #define FREQ_STATUS_VALID BIT(31) #define FREQ_STATUS_ERROR BIT(30) #define FREQ_STATUS_OVERRUN BIT(29) -#define FREQ_STATUS_MASK (BIT(24) - 1) +#define FREQ_STATUS_MASK GENMASK(23, 0) struct ptp_ocp_flash_info { const char *name; @@ -674,9 +675,9 @@ static const struct ocp_selector ptp_ocp_clock[] = { { } }; +#define SMA_DISABLE BIT(16) #define SMA_ENABLE BIT(15) -#define SMA_SELECT_MASK ((1U << 15) - 1) -#define SMA_DISABLE 0x10000 +#define SMA_SELECT_MASK GENMASK(14, 0) static const struct ocp_selector ptp_ocp_sma_in[] = { { .name = "10Mhz", .value = 0x0000 }, @@ -3440,7 +3441,7 @@ ptp_ocp_tod_status_show(struct seq_file *s, void *data) val = ioread32(&bp->tod->utc_status); seq_printf(s, "UTC status register: 0x%08X\n", val); - seq_printf(s, "UTC offset: %d valid:%d\n", + seq_printf(s, "UTC offset: %ld valid:%d\n", val & TOD_STATUS_UTC_MASK, val & TOD_STATUS_UTC_VALID ? 1 : 0); seq_printf(s, "Leap second info valid:%d, Leap second announce %d\n", val & TOD_STATUS_LEAP_VALID ? 1 : 0, From patchwork Wed Jun 8 12:03:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12873361 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71B5FC433EF for ; Wed, 8 Jun 2022 12:04:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238577AbiFHMEA (ORCPT ); Wed, 8 Jun 2022 08:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238540AbiFHMD6 (ORCPT ); Wed, 8 Jun 2022 08:03:58 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B578115CB9; Wed, 8 Jun 2022 05:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654689838; x=1686225838; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8+59vdbtwdJ9mUcZg9lTLgsNCEcr0zI48wsgtLiBnQg=; b=htn9Btg1aKEEiORnPH6UoK69drkvWNxU1avV8ASC+ZSXwmd9A3kye3Wq wvYk7vhGAsGqgsYc5e3J2vjxRpn9YiRdTayeaZTIwmzXV/pU/tNpZ/SYO iJWeqTJ/hJqaIyUnoqdbgVE+ygSNIF0Met6Ka028Yo1Iv7cTzTBJDAx5m ZT6K4/oWyzs8JEaJRbvR3v+X7REiW5ZoB7QyFkF1zHzABFf7cYJKZUEVG EviuJ2K5iPzJN+pKl3GSm78nj8DGWrK7PMQe867uARAPnLrMLDkFEjvVN ygKE28BLPQJbRENzRD1/ZwCySZqMLHN8mi16n64aC8b/dy7k0TIdT6b5Y w==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="274397797" X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="274397797" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 05:03:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="648576519" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 08 Jun 2022 05:03:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C60074E5; Wed, 8 Jun 2022 15:03:59 +0300 (EEST) From: Andy Shevchenko To: Jonathan Lemon , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Cochran , Andy Shevchenko Subject: [PATCH v1 net-next 3/5] ptp_ocp: drop duplicate NULL check in ptp_ocp_detach() Date: Wed, 8 Jun 2022 15:03:56 +0300 Message-Id: <20220608120358.81147-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> References: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since platform_device_unregister() is NULL-aware, we don't need to duplicate this check. Remove it and fold the rest of the code. Signed-off-by: Andy Shevchenko Acked-by: Vadim Fedorenko --- drivers/ptp/ptp_ocp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 926add7be9a2..4e237f806085 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -3701,10 +3701,8 @@ ptp_ocp_detach(struct ptp_ocp *bp) serial8250_unregister_port(bp->mac_port); if (bp->nmea_port != -1) serial8250_unregister_port(bp->nmea_port); - if (bp->spi_flash) - platform_device_unregister(bp->spi_flash); - if (bp->i2c_ctrl) - platform_device_unregister(bp->i2c_ctrl); + platform_device_unregister(bp->spi_flash); + platform_device_unregister(bp->i2c_ctrl); if (bp->i2c_clk) clk_hw_unregister_fixed_rate(bp->i2c_clk); if (bp->n_irqs) From patchwork Wed Jun 8 12:03:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12873365 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8985BCCA47E for ; Wed, 8 Jun 2022 12:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238617AbiFHMEH (ORCPT ); Wed, 8 Jun 2022 08:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238557AbiFHMEA (ORCPT ); Wed, 8 Jun 2022 08:04:00 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41DCE1A89B9; Wed, 8 Jun 2022 05:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654689839; x=1686225839; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9ehcThqPPJkr7iIdF60kt5vvA2SeRoEoSO1WpbnPOAM=; b=QIDNvniuG4dH6N3eHbw3pOW6Ywbhm31QQh157z7HDSv9lXCf9x/wqIEk LweNvBmU5q3dJoEJgOGaFyY0TDZQ1ai3Xa6exbYpHYDx9JBPl6lAs2B6C Cx/QaiklEOIWOxsEDonF1LVacxUjq2AYKDg32pe5NOp8E+Vo64OEhyqH7 BCYg7KWmiAeXNhur/E4lUW+fjbR0ooI97m1T3ElpvsP7NkwajK77bYdb1 6aNmjiE+NoDxuBwQs8hJp49WhMnQNwywsIlDPAKxoMx7LuuW8sTgj5C7q FEpoLd3o1tZErxl3y9jM18LslKM9ul+YSnyrv7UwXFhJ8AaUg4syT+g6L w==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="256701614" X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="256701614" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 05:03:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="533067581" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 08 Jun 2022 05:03:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CAE14450; Wed, 8 Jun 2022 15:03:59 +0300 (EEST) From: Andy Shevchenko To: Jonathan Lemon , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Cochran , Andy Shevchenko Subject: [PATCH v1 net-next 4/5] ptp_ocp: do not call pci_set_drvdata(pdev, NULL) Date: Wed, 8 Jun 2022 15:03:57 +0300 Message-Id: <20220608120358.81147-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> References: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Cleaning up driver data is actually already handled by driver core, so there is no need to do it manually. Signed-off-by: Andy Shevchenko Acked-by: Vadim Fedorenko --- drivers/ptp/ptp_ocp.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 4e237f806085..857e35c68a04 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -3769,7 +3769,6 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) out: ptp_ocp_detach(bp); - pci_set_drvdata(pdev, NULL); out_disable: pci_disable_device(pdev); out_free: @@ -3785,7 +3784,6 @@ ptp_ocp_remove(struct pci_dev *pdev) devlink_unregister(devlink); ptp_ocp_detach(bp); - pci_set_drvdata(pdev, NULL); pci_disable_device(pdev); devlink_free(devlink); From patchwork Wed Jun 8 12:03:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12873366 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD8D4C433EF for ; Wed, 8 Jun 2022 12:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238623AbiFHMEJ (ORCPT ); Wed, 8 Jun 2022 08:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238591AbiFHMEB (ORCPT ); Wed, 8 Jun 2022 08:04:01 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5F1412296A; Wed, 8 Jun 2022 05:04:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654689840; x=1686225840; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7mwdJlzZnKa7PggcpT5MZpyo4vsvD9fXoagVYkh/obk=; b=fZWKYlmHKRWFaMbKa1Xy7BZY0EULjp3C+mN3FwWZ/l4DGGSZ11yTGa9h 9tnuJFR/oFuwh6HC92klrDDWu/hutnSB0yt7IwDQLKR2doZ0vu9+T/t1O Y/LSXent88KHl6c/h3EJ0fgkrUoDDhi2K30EHnZTGwCY7RMEiy3RxTrrE k6Qm0mizTnnPJJHZc5kFftNESmdObvW0MMBeLdmt0vX8x3K+Sstjb+/wr gfVBcWSJc2S5/Y1L5FfOIjC5Mn5UMpY8MV4t/AtOD/+aY27CJuut/4Tjf 52qYZeM1M35Qk2rcrmdJjRLYumxOVMm4P6I7AplQqBu2RN4R5u7ExNVnW A==; X-IronPort-AV: E=McAfee;i="6400,9594,10371"; a="265675615" X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="265675615" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 05:04:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="670517792" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 08 Jun 2022 05:03:58 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D901056B; Wed, 8 Jun 2022 15:03:59 +0300 (EEST) From: Andy Shevchenko To: Jonathan Lemon , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Richard Cochran , Andy Shevchenko Subject: [PATCH v1 net-next 5/5] ptp_ocp: replace kzalloc(x*y) by kcalloc(y, x) Date: Wed, 8 Jun 2022 15:03:58 +0300 Message-Id: <20220608120358.81147-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> References: <20220608120358.81147-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org While here it may be no difference, the kcalloc() has some checks against overflow and it's logically correct to call it for an array. Signed-off-by: Andy Shevchenko Acked-by: Vadim Fedorenko --- drivers/ptp/ptp_ocp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 857e35c68a04..83da36e69361 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -2155,7 +2155,7 @@ ptp_ocp_fb_set_pins(struct ptp_ocp *bp) struct ptp_pin_desc *config; int i; - config = kzalloc(sizeof(*config) * 4, GFP_KERNEL); + config = kcalloc(4, sizeof(*config), GFP_KERNEL); if (!config) return -ENOMEM;