Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2731993rwb; Sat, 8 Oct 2022 13:12:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM436mdSt891i6y0Yap2Pwk0ZusnPJwI+FOS1rGrsOYXlBML1ErhL1hJTUopkyF2WXNG7oL2 X-Received: by 2002:a17:90b:1808:b0:20c:8409:2007 with SMTP id lw8-20020a17090b180800b0020c84092007mr5565293pjb.226.1665259979041; Sat, 08 Oct 2022 13:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665259979; cv=none; d=google.com; s=arc-20160816; b=bx6MpVoXokZK7Oo/Xxk72Rls7uHi/2uXAUTm38tf4AiEPahJsGs2WhDFfLTvVE214q q2Wx4wLBVi6BANcl24selg5BD2lttquLVV8vOCEwOoUFgSN3en1N4WSAeAxluFk3EuO4 uAec2vtdhHGB3XfqjOMX9tz5LEG5KIibF89Z0h/1sRD6484149NRfYeKC58nBKz6hTCI qO25nJOvBZK47oss609TZFrdfDU/9gLLPdnEUy49MZrZpX4y2LC9M6NM1IJLvv31Fc0r D7tZuVLdumRy6Sj3FR6yQFaET1RbWseJKsE26BeeRkkJQ2R64yCiaM6tGH9W05IQpffR 8LaQ== 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=sc2Ix95NutW0Tp3UdrkbraOWSdWxeXfoFIwLbt9L+WSUDEjrMFX9VGsSYXSiWrHA1j 9jhBjmDf7nJgGy6p60ScOlInyoooJ2I0vuXXp4AqYogY3BDTQ0119cdIDPViEoABZPDJ jwK5CIErEj0lOxYQ/e0t1YwoW2bJI64jVLE5iWkIAqS5+YrKrdEBLX6L3Ivp9ul8QgNC Cpe3qyN6Jg6SblGknvCAOp+SfV2lnZ+kriQgBWZzxLWN4j0yK70YizPqLbLaX/slUs/x IeKh9eLwTOOTf/aJLB3FBkmy7ALDaj8ykscIToZcMot1QzHOaS724GPnzuVNdjIi+dGF z6LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="n0tI/K/Z"; 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 k7-20020a635607000000b00439fbc1b5absi6981637pgb.797.2022.10.08.13.12.47; Sat, 08 Oct 2022 13:12:59 -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="n0tI/K/Z"; 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 S229928AbiJHTq7 (ORCPT + 99 others); Sat, 8 Oct 2022 15:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbiJHTq5 (ORCPT ); Sat, 8 Oct 2022 15:46:57 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6A99326DE; Sat, 8 Oct 2022 12:46:55 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id j16so11699104wrh.5; Sat, 08 Oct 2022 12:46:55 -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=n0tI/K/Z7QZYmn1JsfkgpNVg6VscSyMimstyBK/nL8weDKMf56DUqs5z98GR9R6l5f TUw0aMsDkzGqOwoS12y4GI2dXLv2vlzqU4FudQz+ntgGnjOyoja+QMFmYj/seDjI9Xb0 +d9aNHS5QWbeBLe/EupmqE+NsCcHvA01YPRvbJaLATdlW6Je8M/Sz7MKpHD9xylE3LH8 QbM/VVAAGHORkCuLA4y2ZLWytZVkW7hvyQXnzwrhPkoje+JUbzcawbIIf3eLOOBJ2oxm UvGVvbtCej2VOaLl1kRas+ETQ/X2A1fhpaZbwUfhdmlzePrndmNQ6XlZ2owoBYkVTYFD PO6w== 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=AkNrECdGuLIfkLpmbkkToa3zDJ2i16TMBZLvw/QBjURkb2PRxV+VCNE1zumGcimB/c 2GZtGr4Nbugnb0M/5nf/uEsxjZXFWUE/aQx1oy73jxg39ovTpYebRVHaproPXjyQhqwr esI1JI0OJovIE6j3SThZaBcjBBgtP3M2RM97tFFqWq01b7X8uQ2+jkBaJ0E+Az/d2ptu gCKbb+BBR0X8KgOllcaJNz8vNwBtD7YjL7XfBRmd0cT3gE8voAin0fdmqBna1e9sNUO8 EUHfX+pvLcKIlt+ySYYSiJOxzkktmxpnXplaa49HrIH1QYZMNSf+Im2nlZSpGWU7srdg RIgg== X-Gm-Message-State: ACrzQf2PDr/wutkQx+SSwQfekpDg9bmhRq3Og7iJlWPXwfp3XVPpdGmP FO31k1f1ZYu1qnJUUOjk1w5n4npauQ== X-Received: by 2002:adf:f9c9:0:b0:22e:3581:2422 with SMTP id w9-20020adff9c9000000b0022e35812422mr7006215wrr.592.1665258414357; Sat, 08 Oct 2022 12:46:54 -0700 (PDT) Received: from octinomon ([2a00:23c8:2f02:3b01:3ea1:40:8650:189]) by smtp.gmail.com with ESMTPSA id i129-20020a1c3b87000000b003b50428cf66sm2291828wma.33.2022.10.08.12.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Oct 2022 12:46:54 -0700 (PDT) From: Jules Irenge X-Google-Original-From: Jules Irenge Date: Sat, 8 Oct 2022 20:46:52 +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 2/2] 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