.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License as published by |
---|
6 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
7 | | - * (at your option) any later version. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | | - * |
---|
14 | | - * You should have received a copy of the GNU General Public License |
---|
15 | | - * along with this program; if not, write to the Free Software |
---|
16 | | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
17 | | - * |
---|
18 | 4 | */ |
---|
19 | 5 | |
---|
20 | 6 | #include <linux/device.h> |
---|
.. | .. |
---|
188 | 174 | break; |
---|
189 | 175 | case MTD_FILE_MODE_RAW: |
---|
190 | 176 | { |
---|
191 | | - struct mtd_oob_ops ops; |
---|
| 177 | + struct mtd_oob_ops ops = {}; |
---|
192 | 178 | |
---|
193 | 179 | ops.mode = MTD_OPS_RAW; |
---|
194 | 180 | ops.datbuf = kbuf; |
---|
.. | .. |
---|
282 | 268 | |
---|
283 | 269 | case MTD_FILE_MODE_RAW: |
---|
284 | 270 | { |
---|
285 | | - struct mtd_oob_ops ops; |
---|
| 271 | + struct mtd_oob_ops ops = {}; |
---|
286 | 272 | |
---|
287 | 273 | ops.mode = MTD_OPS_RAW; |
---|
288 | 274 | ops.datbuf = kbuf; |
---|
.. | .. |
---|
363 | 349 | uint64_t start, uint32_t length, void __user *ptr, |
---|
364 | 350 | uint32_t __user *retp) |
---|
365 | 351 | { |
---|
| 352 | + struct mtd_info *master = mtd_get_master(mtd); |
---|
366 | 353 | struct mtd_file_info *mfi = file->private_data; |
---|
367 | | - struct mtd_oob_ops ops; |
---|
| 354 | + struct mtd_oob_ops ops = {}; |
---|
368 | 355 | uint32_t retlen; |
---|
369 | 356 | int ret = 0; |
---|
370 | 357 | |
---|
371 | 358 | if (length > 4096) |
---|
372 | 359 | return -EINVAL; |
---|
373 | 360 | |
---|
374 | | - if (!mtd->_write_oob) |
---|
| 361 | + if (!master->_write_oob) |
---|
375 | 362 | return -EOPNOTSUPP; |
---|
376 | 363 | |
---|
377 | 364 | ops.ooblen = length; |
---|
.. | .. |
---|
405 | 392 | uint32_t __user *retp) |
---|
406 | 393 | { |
---|
407 | 394 | struct mtd_file_info *mfi = file->private_data; |
---|
408 | | - struct mtd_oob_ops ops; |
---|
| 395 | + struct mtd_oob_ops ops = {}; |
---|
409 | 396 | int ret = 0; |
---|
410 | 397 | |
---|
411 | 398 | if (length > 4096) |
---|
.. | .. |
---|
597 | 584 | static int mtdchar_write_ioctl(struct mtd_info *mtd, |
---|
598 | 585 | struct mtd_write_req __user *argp) |
---|
599 | 586 | { |
---|
| 587 | + struct mtd_info *master = mtd_get_master(mtd); |
---|
600 | 588 | struct mtd_write_req req; |
---|
601 | | - struct mtd_oob_ops ops; |
---|
| 589 | + struct mtd_oob_ops ops = {}; |
---|
602 | 590 | const void __user *usr_data, *usr_oob; |
---|
603 | 591 | int ret; |
---|
604 | 592 | |
---|
.. | .. |
---|
608 | 596 | usr_data = (const void __user *)(uintptr_t)req.usr_data; |
---|
609 | 597 | usr_oob = (const void __user *)(uintptr_t)req.usr_oob; |
---|
610 | 598 | |
---|
611 | | - if (!mtd->_write_oob) |
---|
| 599 | + if (!master->_write_oob) |
---|
612 | 600 | return -EOPNOTSUPP; |
---|
613 | | - |
---|
614 | 601 | ops.mode = req.mode; |
---|
615 | 602 | ops.len = (size_t)req.len; |
---|
616 | 603 | ops.ooblen = (size_t)req.ooblen; |
---|
.. | .. |
---|
646 | 633 | { |
---|
647 | 634 | struct mtd_file_info *mfi = file->private_data; |
---|
648 | 635 | struct mtd_info *mtd = mfi->mtd; |
---|
| 636 | + struct mtd_info *master = mtd_get_master(mtd); |
---|
649 | 637 | void __user *argp = (void __user *)arg; |
---|
650 | 638 | int ret = 0; |
---|
651 | 639 | struct mtd_info_user info; |
---|
.. | .. |
---|
874 | 862 | { |
---|
875 | 863 | struct nand_oobinfo oi; |
---|
876 | 864 | |
---|
877 | | - if (!mtd->ooblayout) |
---|
| 865 | + if (!master->ooblayout) |
---|
878 | 866 | return -EOPNOTSUPP; |
---|
879 | 867 | |
---|
880 | 868 | ret = get_oobinfo(mtd, &oi); |
---|
.. | .. |
---|
968 | 956 | { |
---|
969 | 957 | struct nand_ecclayout_user *usrlay; |
---|
970 | 958 | |
---|
971 | | - if (!mtd->ooblayout) |
---|
| 959 | + if (!master->ooblayout) |
---|
972 | 960 | return -EOPNOTSUPP; |
---|
973 | 961 | |
---|
974 | 962 | usrlay = kmalloc(sizeof(*usrlay), GFP_KERNEL); |
---|