| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /*************************************************************************** |
|---|
| 2 | 3 | * Copyright (C) 2010-2012 by Bruno Prémont <bonbons@linux-vserver.org> * |
|---|
| 3 | 4 | * * |
|---|
| 4 | 5 | * Based on Logitech G13 driver (v0.4) * |
|---|
| 5 | 6 | * Copyright (C) 2009 by Rick L. Vinyard, Jr. <rvinyard@cs.nmsu.edu> * |
|---|
| 6 | 7 | * * |
|---|
| 7 | | - * This program is free software: you can redistribute it and/or modify * |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by * |
|---|
| 9 | | - * the Free Software Foundation, version 2 of the License. * |
|---|
| 10 | | - * * |
|---|
| 11 | | - * This driver is distributed in the hope that it will be useful, but * |
|---|
| 12 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
|---|
| 14 | | - * General Public License for more details. * |
|---|
| 15 | | - * * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License * |
|---|
| 17 | | - * along with this software. If not see <http://www.gnu.org/licenses/>. * |
|---|
| 18 | 8 | ***************************************************************************/ |
|---|
| 19 | 9 | |
|---|
| 20 | 10 | #include <linux/hid.h> |
|---|
| .. | .. |
|---|
| 427 | 417 | return 0; |
|---|
| 428 | 418 | } |
|---|
| 429 | 419 | |
|---|
| 430 | | -/* Note this can't be const because of struct fb_info definition */ |
|---|
| 431 | | -static struct fb_ops picolcdfb_ops = { |
|---|
| 420 | +static const struct fb_ops picolcdfb_ops = { |
|---|
| 432 | 421 | .owner = THIS_MODULE, |
|---|
| 433 | 422 | .fb_destroy = picolcd_fb_destroy, |
|---|
| 434 | 423 | .fb_read = fb_sys_read, |
|---|
| .. | .. |
|---|
| 469 | 458 | if (ret >= PAGE_SIZE) |
|---|
| 470 | 459 | break; |
|---|
| 471 | 460 | else if (i == fb_update_rate) |
|---|
| 472 | | - ret += snprintf(buf+ret, PAGE_SIZE-ret, "[%u] ", i); |
|---|
| 461 | + ret += scnprintf(buf+ret, PAGE_SIZE-ret, "[%u] ", i); |
|---|
| 473 | 462 | else |
|---|
| 474 | | - ret += snprintf(buf+ret, PAGE_SIZE-ret, "%u ", i); |
|---|
| 463 | + ret += scnprintf(buf+ret, PAGE_SIZE-ret, "%u ", i); |
|---|
| 475 | 464 | if (ret > 0) |
|---|
| 476 | 465 | buf[min(ret, (size_t)PAGE_SIZE)-1] = '\n'; |
|---|
| 477 | 466 | return ret; |
|---|
| .. | .. |
|---|
| 522 | 511 | sizeof(struct fb_deferred_io) + |
|---|
| 523 | 512 | sizeof(struct picolcd_fb_data) + |
|---|
| 524 | 513 | PICOLCDFB_SIZE, dev); |
|---|
| 525 | | - if (info == NULL) { |
|---|
| 526 | | - dev_err(dev, "failed to allocate a framebuffer\n"); |
|---|
| 514 | + if (!info) |
|---|
| 527 | 515 | goto err_nomem; |
|---|
| 528 | | - } |
|---|
| 529 | 516 | |
|---|
| 530 | 517 | info->fbdefio = info->par; |
|---|
| 531 | 518 | *info->fbdefio = picolcd_fb_defio; |
|---|