Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2747758rwb; Sat, 8 Oct 2022 13:34:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F1otsfKUQASwsR3ctrdUE2L79CEE8NUcD11l7TZza2sFIraaPaYW8D10nbBTT2q7t2ZAC X-Received: by 2002:a63:5511:0:b0:439:12f6:fb9a with SMTP id j17-20020a635511000000b0043912f6fb9amr10263612pgb.197.1665261282404; Sat, 08 Oct 2022 13:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665261282; cv=none; d=google.com; s=arc-20160816; b=HtX3EEmlRHUi2K+vblmefyzOn2MtpY4TIKddIqcZRwqvngvhDRFXMNr9SFL4LL8Qsy hqtmERv2zztty3CHR58wcWCVUmIQwvaUGDZRjrS/R6TdXMhE1y1tTU4VDN7xq+/XbF8B cFTTkQ/3CNiMnrjQASblp6GG3u2Ima0AQYZrS/Wv+3NOf2gNEy6m5Ecy1b+F8tNBO5ii EZk+QnH1TRXL1TbiCCDuJlObnmBhs7Z83MFd3zEnXL1KdBmstUOKvH1MKj8OrysGaMus ObarIjuEuUmrSbOJcFqN85AxJbGPyMe9efsrcypE/VlKHe8eyOlXhgKhUyWC0he7ZmHV K0VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:date:from:dkim-signature; bh=ug3lOc6jfgPHpJPdL4UNADTEvLPCskKFnlfe0HCOmbw=; b=j9pgPZ7CjLFa4/Ozj/211NUoN0Lv1AvQEd8BvoD3fbUkFZzAndu5Yo1M/NCM5FKQgV SRKv65no1NgJz5ANU2kexq5dZesm6ukWPKvEMlZqGKhiICZVCZCjR4wCD5f922RecESc /CvL68W7SfjXCDkGd4NjRfweUDYHtFQmhnLgoP0iM7BtKiwmX5y0I6fSE1kUaN/dP5Bt 8IHULsF0HaYOWnF6xO+Xmu5ZmmqgIfGSaAWpiaQlGX8SOFOCqOv+GnbvEKQe8wFWdAMR Br45U8ZFfw3E+dBGLuGnyOC7anYYOiIVLsRTrZKojsSIPUaEgXKyme8yiyF41Jy1+pMY 86Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nOUzwtYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r134-20020a632b8c000000b00460a5961827si2086782pgr.651.2022.10.08.13.34.18; Sat, 08 Oct 2022 13:34:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nOUzwtYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229814AbiJHTY6 (ORCPT + 99 others); Sat, 8 Oct 2022 15:24:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbiJHTYz (ORCPT ); Sat, 8 Oct 2022 15:24:55 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E64A1929F; Sat, 8 Oct 2022 12:24:53 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id bk15so11615831wrb.13; Sat, 08 Oct 2022 12:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:date:from :from:to:cc:subject:date:message-id:reply-to; bh=ug3lOc6jfgPHpJPdL4UNADTEvLPCskKFnlfe0HCOmbw=; b=nOUzwtYiCzHdMnAmTs+5UaATq86aPTUSRjjgcsSBh3RAI+R+hT40Yta2dNH6UogZw1 rpO48kqndJN9EeQEtqZi7EIuYO6Us9jwec0lEU4PZS5Jfa0KwbQ5IwplUuIwaSvMSBfi XlHWgv8O5LXX2IKvB9Cm8SFA+m4Ytv0ye/mRWbAskJtWPIgVZFuFlqOJGYaeGwR4T183 9DZ+lbWITQ8uEAgUdvKkJYRKJf9CKs4+PqPvQMLkWgK60CfjzK1G6bstaP53Rx/2aHdY WhTV4qPLsAJV61zUZGjuobt13i5P4p8ZKCBJWSLCg5nHbApq+RXB7zU4liE4YrsKVBPv 4TKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ug3lOc6jfgPHpJPdL4UNADTEvLPCskKFnlfe0HCOmbw=; b=wscSAs4OFbTxxZpB+5kWX0KMauBD8ojHShH2sKHWr/tkuhZQgA5E8FNyR1V9nJFSpS fUrzqeaa90cMO6icAdn2nTkRFqN8nkMP85V/XR96rGsGsc2egS9Anp5Ao+uaagS5mljQ 7Bc6pJTpIoRxe+ZOP5XMf+tlj+tI3YQphOthpO+IBFJwm/uwcXnZd3uUZmNzOqF5xdcd dUw9fSTWbvgGO+5SyHS6GTlaLKjb6298XHvgGggyheErn8YhRivbDvNKb4tbwrgx1lNr W8jMOBHI0VWz9sRZ12Ix8NJ50E4sWn3PgFRQbSzzJl1YV2lTxmMAtwRDuVa4q0amEW8W S3Yw== X-Gm-Message-State: ACrzQf2RJIcgZE5CB9ieuMX14eCu7fsgzpv5Wt16sAt705l1mn3UwHPx VeoknguNN6f0o/tIuwxnCA== X-Received: by 2002:adf:d1cc:0:b0:22e:6371:65ad with SMTP id b12-20020adfd1cc000000b0022e637165admr6946730wrd.326.1665257092268; Sat, 08 Oct 2022 12:24:52 -0700 (PDT) Received: from octinomon ([2a00:23c8:2f02:3b01:3ea1:40:8650:189]) by smtp.gmail.com with ESMTPSA id h17-20020a056000001100b00228d67db06esm5141209wrx.21.2022.10.08.12.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Oct 2022 12:24:51 -0700 (PDT) From: Jules Irenge X-Google-Original-From: Jules Irenge Date: Sat, 8 Oct 2022 20:24:49 +0100 To: erazor_de@users.sourceforge.net Cc: jikos@kernel.org, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] HID: roccat: Convert snprintf() to sysfs_emit() Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Coccinnelle reports a warning Warning: Use scnprintf or sprintf Following the advice on kernel documentation https://www.kernel.org/doc/html/latest/filesystems/sysfs.html For show(device *...) functions we should only use sysfs_emit() or sysfs_emit_at() especially when formatting the value to be returned to user space. Convert snprintf() to sysfs_emit() Signed-off-by: Jules Irenge --- drivers/hid/hid-roccat-koneplus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-roccat-koneplus.c b/drivers/hid/hid-roccat-koneplus.c index 1896c69ea512..1635ddc7c3cf 100644 --- a/drivers/hid/hid-roccat-koneplus.c +++ b/drivers/hid/hid-roccat-koneplus.c @@ -244,7 +244,7 @@ static ssize_t koneplus_sysfs_show_actual_profile(struct device *dev, { struct koneplus_device *koneplus = hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); - return snprintf(buf, PAGE_SIZE, "%d\n", koneplus->actual_profile); + return sysfs_emit(buf, "%d\n", koneplus->actual_profile); } static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev, @@ -311,7 +311,7 @@ static ssize_t koneplus_sysfs_show_firmware_version(struct device *dev, &info, KONEPLUS_SIZE_INFO); mutex_unlock(&koneplus->koneplus_lock); - return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version); + return sysfs_emit(buf, "%d\n", info.firmware_version); } static DEVICE_ATTR(firmware_version, 0440, koneplus_sysfs_show_firmware_version, NULL); -- 2.37.3