Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp75597pxb; Tue, 2 Feb 2021 23:25:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbtE+RspvKj+l+6bzQj4Pe9O0KwHpNdj9q+VTXdSV8TqTjqw3wv7NFYPUp53aR9QWQy5dA X-Received: by 2002:a17:906:607:: with SMTP id s7mr1850386ejb.301.1612337128410; Tue, 02 Feb 2021 23:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612337128; cv=none; d=google.com; s=arc-20160816; b=CyXUB1QlXU5ZgeHqS+GAsUlocS8inWv/wyUPXmPP2aq0zLJsOESUlCE27AMmayeI7+ qJoK+u7TwARgowOpRuXcdP8DZJoI2N2VpzioQAqkeWxl4RLfKe2RUvQAxYx69Q1TNjEp r7YjsKu5NPPreZSCuuqtjNkMiUhf7WFrnrKxhXkHpo1gujlrayrB+bhEafc/rd/cYiZo sgo6T/tG7oYkqfLoA4BWnOmstXEbqMt0kibt7ZR8UJ49wImEb8CII6hUqsZ/jULNA/xT Of7osqiJ1DUL7f67PbGu+zmZEXoQhztM6in/L3oyrQjlfDN0VmEf4GTdTPMwlvkCQD5Z Fx/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=CzT5OzgUL1pqt1ryZMb/Za8P2IAJMwEU8I9Pjp7zq8c=; b=w1NE4T0WDNC0/aThI1PMY/jrhAgmEjDpabBiw2gts4Ylxicbd0kDIIqNoaxxkk6Fjf Qc+Wj93/PXl7w5aBvj9qZKpPgdex5veEWPDHtgEuug+JeHCxyre+ZYvBUd0u4Iyc3BZr z/J+qMmRqDt8nkd2FSKBHV0Qmw2f92bHlHGYVgWYJ3qlil+dVWwGZu88T+R1SS+ss+DD 8JXE1X0m4imrteAIDm4pzDzuvBLP9WN/tU8D8gM263Of4LS2Yu9Aq4mVU56uhX2TM33B XSIe+4JWHe0CBzZ1T6wO8sqKPJnU9hW9aJApu3bgd/j9Uu5MkoLIcKHNUhoPnGsOoQg7 Ty2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si456253ejv.427.2021.02.02.23.25.03; Tue, 02 Feb 2021 23:25:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232046AbhBCHXx (ORCPT + 99 others); Wed, 3 Feb 2021 02:23:53 -0500 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:34219 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231465AbhBCHXv (ORCPT ); Wed, 3 Feb 2021 02:23:51 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R861e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0UNkEs0-_1612336976; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0UNkEs0-_1612336976) by smtp.aliyun-inc.com(127.0.0.1); Wed, 03 Feb 2021 15:23:04 +0800 From: Jiapeng Chong To: alexander.deucher@amd.com Cc: christian.koenig@amd.com, airlied@linux.ie, daniel@ffwll.ch, sumit.semwal@linaro.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Jiapeng Chong Subject: [PATCH] drm/amdgpu: convert sysfs sprintf/snprintf family to sysfs_emit Date: Wed, 3 Feb 2021 15:22:53 +0800 Message-Id: <1612336973-70151-1-git-send-email-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following coccicheck warning: ./drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:207:8-16: WARNING: use scnprintf or sprintf. ./drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:185:8-16: WARNING: use scnprintf or sprintf. ./drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:163:8-16: WARNING: use scnprintf or sprintf. ./drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:139:8-16: WARNING: use scnprintf or sprintf. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index cab1eba..89b5e7c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -136,7 +136,7 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev, struct amdgpu_device *adev = drm_to_adev(ddev); uint64_t cnt = amdgpu_asic_get_pcie_replay_count(adev); - return snprintf(buf, PAGE_SIZE, "%llu\n", cnt); + return sysfs_emit(buf, "%llu\n", cnt); } static DEVICE_ATTR(pcie_replay_count, S_IRUGO, @@ -160,7 +160,7 @@ static ssize_t amdgpu_device_get_product_name(struct device *dev, struct drm_device *ddev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(ddev); - return snprintf(buf, PAGE_SIZE, "%s\n", adev->product_name); + return sysfs_emit(buf, "%s\n", adev->product_name); } static DEVICE_ATTR(product_name, S_IRUGO, @@ -182,7 +182,7 @@ static ssize_t amdgpu_device_get_product_number(struct device *dev, struct drm_device *ddev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(ddev); - return snprintf(buf, PAGE_SIZE, "%s\n", adev->product_number); + return sysfs_emit(buf, "%s\n", adev->product_number); } static DEVICE_ATTR(product_number, S_IRUGO, @@ -204,7 +204,7 @@ static ssize_t amdgpu_device_get_serial_number(struct device *dev, struct drm_device *ddev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(ddev); - return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial); + return sysfs_emit(buf, "%s\n", adev->serial); } static DEVICE_ATTR(serial_number, S_IRUGO, -- 1.8.3.1